summaryrefslogtreecommitdiff
path: root/src/timedated.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/timedated.c')
-rw-r--r--src/timedated.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/timedated.c b/src/timedated.c
index 097e0a00c2..55cc904f0c 100644
--- a/src/timedated.c
+++ b/src/timedated.c
@@ -543,8 +543,15 @@ static int connect_bus(DBusConnection **_bus) {
goto fail;
}
- if (dbus_bus_request_name(bus, "org.freedesktop.timedate1", 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.timedate1", 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;
}