From: Lennart Poettering Date: Mon, 27 Jun 2011 21:07:28 +0000 (+0200) Subject: logind: properly detect whether we got the bus name X-Git-Tag: v30~137 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bafd4449ff851076b69ffaf918068465a726d928;p=systemd logind: properly detect whether we got the bus name --- diff --git a/src/logind.c b/src/logind.c index 25773209..863b1636 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; }