X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftimedate%2Ftimedatectl.c;h=be3b8b4da303290e2398cd99421f9ba3195e47c2;hb=2927b326ccf67236e148444679f582ea1437ef5a;hp=f5b5f0ca84e9accc702b1a4f8e4164de42ee8bd2;hpb=7c2d80944afb4196f2eff614e8da1450dffcbeaa;p=elogind.git diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index f5b5f0ca8..be3b8b4da 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -51,7 +51,7 @@ static void pager_open_if_enabled(void) { if (arg_no_pager) return; - pager_open(); + pager_open(false); } static void polkit_agent_open_if_enabled(void) { @@ -68,12 +68,12 @@ typedef struct StatusInfo { const char *timezone; bool local_rtc; bool ntp; + bool can_ntp; } StatusInfo; static bool ntp_synced(void) { - struct timex txc; + struct timex txc = {}; - zero(txc); if (adjtimex(&txc) < 0) return false; @@ -153,7 +153,7 @@ static void print_status_info(StatusInfo *i) { " RTC in local TZ: %s\n", strna(i->timezone), a, - yes_no(i->ntp), + i->can_ntp ? yes_no(i->ntp) : "n/a", yes_no(ntp_synced()), yes_no(i->local_rtc)); @@ -228,6 +228,8 @@ static int status_property(const char *name, DBusMessageIter *iter, StatusInfo * i->local_rtc = b; else if (streq(name, "NTP")) i->ntp = b; + else if (streq(name, "CanNTP")) + i->can_ntp = b; } } @@ -239,7 +241,7 @@ static int show_status(DBusConnection *bus, char **args, unsigned n) { const char *interface = ""; int r; DBusMessageIter iter, sub, sub2, sub3; - StatusInfo info; + StatusInfo info = {}; assert(args); @@ -263,7 +265,6 @@ static int show_status(DBusConnection *bus, char **args, unsigned n) { return -EIO; } - zero(info); dbus_message_iter_recurse(&iter, &sub); while (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID) { @@ -500,6 +501,7 @@ static int help(void) { " --adjust-system-clock\n" " Adjust system clock when changing local RTC mode\n" " --no-pager Do not pipe output into a pager\n" + " -P --privileged Acquire privileges before execution\n" " --no-ask-password Do not prompt for password\n" " -H --host=[USER@]HOST Operate on remote host\n\n" "Commands:\n"