diff options
author | Andreas Volz <andreas@frodo.mittelerde> | 2009-10-06 21:39:58 +0200 |
---|---|---|
committer | Andreas Volz <andreas@frodo.mittelerde> | 2009-10-06 21:39:58 +0200 |
commit | a2f2b93e3667ba6403d040cee40a1c81f8fe13fc (patch) | |
tree | 3c53f1888f2c611f3bece55d8acd78719d29169e | |
parent | 1979ced0e0741caae3299c7f94733ba4d62a1e65 (diff) | |
download | dbus-c++-a2f2b93e3667ba6403d040cee40a1c81f8fe13fc.tar.gz |
check return value
-rw-r--r-- | examples/glib/dbus-browser.cpp | 3 | ||||
-rw-r--r-- | src/connection.cpp | 14 |
2 files changed, 14 insertions, 3 deletions
diff --git a/examples/glib/dbus-browser.cpp b/examples/glib/dbus-browser.cpp index 382d07f..94a3936 100644 --- a/examples/glib/dbus-browser.cpp +++ b/examples/glib/dbus-browser.cpp @@ -126,7 +126,10 @@ int main(int argc, char *argv[]) dispatcher.attach(NULL); + // activate one of both for either system or session bus + // TODO: choose in the GUI DBus::Connection conn = DBus::Connection::SessionBus(); + //DBus::Connection conn = DBus::Connection::SystemBus(); DBusBrowser browser(conn); diff --git a/src/connection.cpp b/src/connection.cpp index db38d17..b882eda 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -384,9 +384,17 @@ void Connection::request_name(const char *name, int flags) debug_log("%s: registering bus name %s", unique_name(), name); - dbus_bus_request_name(_pvt->conn, name, flags, e); //we deliberately don't check return value - - if (e) throw Error(e); + /* + * TODO: + * Think about giving back the 'ret' value. Some people on the list + * requested about this... + */ + int ret = dbus_bus_request_name(_pvt->conn, name, flags, e); + + if (ret == -1) + { + if (e) throw Error(e); + } // this->remove_match("destination"); |