X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftimedated.c;h=4abcf1af73df3a88f0a48b3383cfabd15077ee62;hb=d937fbbd97760d4d1a59dc0fa6f3000e57a96998;hp=a6ec26276bc1083412f7282cef291eda4c8a7442;hpb=91f9dcaf9270fe465525638cc08bd94590273349;p=elogind.git diff --git a/src/timedated.c b/src/timedated.c index a6ec26276..4abcf1af7 100644 --- a/src/timedated.c +++ b/src/timedated.c @@ -332,7 +332,7 @@ static DBusHandlerResult timedate_message_handler( struct tm *tm; /* 2. Teach kernel new timezone */ - hwclock_apply_localtime_delta(); + hwclock_apply_localtime_delta(NULL); /* 3. Sync RTC from system clock, with the new delta */ assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0); @@ -382,7 +382,7 @@ static DBusHandlerResult timedate_message_handler( /* 2. Teach kernel new timezone */ if (local_rtc) - hwclock_apply_localtime_delta(); + hwclock_apply_localtime_delta(NULL); else hwclock_reset_localtime_delta(); @@ -532,7 +532,7 @@ static int connect_bus(DBusConnection **_bus) { bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error); if (!bus) { - log_error("Failed to get system D-Bus connection: %s", error.message); + log_error("Failed to get system D-Bus connection: %s", bus_error_message(&error)); r = -ECONNREFUSED; goto fail; } @@ -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; }