summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqar Hameed <waqarh@axis.com>2018-10-04 13:35:43 +0200
committerWilliam A. Kennington III <wak@google.com>2018-10-23 21:12:30 +0000
commit841d8d35173741654a771bec26569313b85af93b (patch)
tree0ac30562122933905c4b5859855a2a19a1dd2c62
parentd94226d26f5ffcb0f2ee24021a20638a6e93d82a (diff)
downloadsdbusplus-841d8d35173741654a771bec26569313b85af93b.tar.gz
sdbusplus-841d8d35173741654a771bec26569313b85af93b.zip
bus: check if D-Bus service name request was successful
Solves issue #21 on github. Change-Id: I71ef2be8b2a2fc8ff82410b6aed12c76140b5606 Signed-off-by: Waqar Hameed <waqarh@axis.com>
-rw-r--r--sdbusplus/bus.hpp.in6
1 files changed, 5 insertions, 1 deletions
diff --git a/sdbusplus/bus.hpp.in b/sdbusplus/bus.hpp.in
index e01d1f2..e80d5ed 100644
--- a/sdbusplus/bus.hpp.in
+++ b/sdbusplus/bus.hpp.in
@@ -186,7 +186,11 @@ struct bus
*/
void request_name(const char* service)
{
- _intf->sd_bus_request_name(_bus.get(), service, 0);
+ int r = _intf->sd_bus_request_name(_bus.get(), service, 0);
+ if (r < 0)
+ {
+ throw exception::SdBusError(-r, "sd_bus_request_name");
+ }
}
/** @brief Create a method_call message.
OpenPOWER on IntegriCloud