diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-10-17 21:24:36 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-10-17 21:25:43 +0200 |
commit | 599659860c770058f2eb04d578c521c16e0b1853 (patch) | |
tree | 8e6fe89877fd962655bd9fb454eb6ba7490d8b2b /src/timedate/timedatectl.c | |
parent | 01539d6ef9689ffdc7c0743e12740a78bb938b97 (diff) |
timedatectl: properly initialize struct before decoding bus messages
Diffstat (limited to 'src/timedate/timedatectl.c')
-rw-r--r-- | src/timedate/timedatectl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index 8c6e7c9212..e94a847bf1 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -69,11 +69,9 @@ typedef struct StatusInfo { } StatusInfo; static bool ntp_synced(void) { - struct timex txc; zero(txc); - if (adjtimex(&txc) < 0) return false; @@ -90,6 +88,8 @@ static void print_status_info(StatusInfo *i) { time_t sec; int r; + assert(i); + n = now(CLOCK_REALTIME); sec = (time_t) (n / USEC_PER_SEC); @@ -191,6 +191,7 @@ 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) { |