X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftimedate%2Ftimedated.c;h=7a51101f253ca966ca8499d6df3cab787d320ab8;hb=e2875c46936a16efc0f58f9e6e2570cdda8d6d98;hp=97306e9a3236cb4d6e285aa56a65f5f35d8c6062;hpb=d200735e13c52dcfe36c0e066f9f6c2fbfb85a9c;p=elogind.git diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index 97306e9a3..7a51101f2 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -6,16 +6,16 @@ Copyright 2011 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -304,7 +304,7 @@ static int write_data_local_rtc(void) { static int read_ntp(DBusConnection *bus) { DBusMessage *m = NULL, *reply = NULL; - const char *name = "ntpd.service", *s; + const char *name = "systemd-timedated-ntp.target", *s; DBusError error; int r; @@ -334,6 +334,14 @@ static int read_ntp(DBusConnection *bus) { reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error); if (!reply) { + + if (streq(error.name, "org.freedesktop.DBus.Error.FileNotFound")) { + /* NTP is not installed. */ + tz.use_ntp = false; + r = 0; + goto finish; + } + log_error("Failed to issue method call: %s", bus_error_message(&error)); r = -EIO; goto finish; @@ -366,7 +374,7 @@ finish: static int start_ntp(DBusConnection *bus, DBusError *error) { DBusMessage *m = NULL, *reply = NULL; - const char *name = "ntpd.service", *mode = "replace"; + const char *name = "systemd-timedated-ntp.target", *mode = "replace"; int r; assert(bus); @@ -413,7 +421,7 @@ finish: static int enable_ntp(DBusConnection *bus, DBusError *error) { DBusMessage *m = NULL, *reply = NULL; - const char * const names[] = { "ntpd.service", NULL }; + const char * const names[] = { "systemd-timedated-ntp.target", NULL }; int r; DBusMessageIter iter; dbus_bool_t f = FALSE, t = TRUE; @@ -553,7 +561,7 @@ static DBusHandlerResult timedate_message_handler( if (!streq_ptr(z, tz.zone)) { char *t; - r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-timezone", interactive, &error); + r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-timezone", interactive, NULL, &error); if (r < 0) return bus_send_error_reply(connection, message, &error, r); @@ -611,7 +619,7 @@ static DBusHandlerResult timedate_message_handler( if (lrtc != tz.local_rtc) { struct timespec ts; - r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-local-rtc", interactive, &error); + r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-local-rtc", interactive, NULL, &error); if (r < 0) return bus_send_error_reply(connection, message, &error, r); @@ -702,7 +710,7 @@ static DBusHandlerResult timedate_message_handler( struct timespec ts; struct tm* tm; - r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-time", interactive, &error); + r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-time", interactive, NULL, &error); if (r < 0) return bus_send_error_reply(connection, message, &error, r); @@ -741,7 +749,7 @@ static DBusHandlerResult timedate_message_handler( if (ntp != !!tz.use_ntp) { - r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-ntp", interactive, &error); + r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-ntp", interactive, NULL, &error); if (r < 0) return bus_send_error_reply(connection, message, &error, r);