summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-06-27 23:07:28 +0200
committerLennart Poettering <lennart@poettering.net>2011-06-27 23:07:28 +0200
commitbafd4449ff851076b69ffaf918068465a726d928 (patch)
tree8a6c69d5640a2a770ef95106333de9f213517b35
parente9816c4859454d341279f1c9e77df4af4bacd534 (diff)
logind: properly detect whether we got the bus name
-rw-r--r--src/logind.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/logind.c b/src/logind.c
index 25773209ea..863b1636df 100644
--- a/src/logind.c
+++ b/src/logind.c
@@ -764,8 +764,15 @@ static int manager_connect_bus(Manager *m) {
goto fail;
}
- if (dbus_bus_request_name(m->bus, "org.freedesktop.login1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error) < 0) {
- log_error("Failed to register name on bus: %s", error.message);
+ r = dbus_bus_request_name(m->bus, "org.freedesktop.login1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error);
+ if (dbus_error_is_set(&error)) {
+ log_error("Failed to register name on bus: %s", bus_error_message(&error));
+ r = -EIO;
+ goto fail;
+ }
+
+ if (r != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ log_error("Failed to acquire name.");
r = -EEXIST;
goto fail;
}