summaryrefslogtreecommitdiff
path: root/src/localed.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-06-27 23:15:57 +0200
committerLennart Poettering <lennart@poettering.net>2011-06-27 23:15:57 +0200
commitadd10b5ae7636137f530e15efdf7af075d6361eb (patch)
tree28100377b4325718b81b42bf790a90b23549ad77 /src/localed.c
parenta2e5283217b9e1e636ab3272e8d36e724a78cf6a (diff)
dbus: fix name allocation logic
Diffstat (limited to 'src/localed.c')
-rw-r--r--src/localed.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/localed.c b/src/localed.c
index 5efee0b2ac..93e4e9bd56 100644
--- a/src/localed.c
+++ b/src/localed.c
@@ -540,8 +540,15 @@ static int connect_bus(DBusConnection **_bus) {
goto fail;
}
- if (dbus_bus_request_name(bus, "org.freedesktop.locale1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error) < 0) {
- log_error("Failed to register name on bus: %s", error.message);
+ r = dbus_bus_request_name(bus, "org.freedesktop.locale1", 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 = -EEXIST;
+ goto fail;
+ }
+
+ if (r != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ log_error("Failed to acquire name.");
r = -EEXIST;
goto fail;
}