From: Lennart Poettering Date: Mon, 4 Mar 2024 12:02:57 +0000 (+0100) Subject: hostnamectl: properly initialize the two timestamp fields before doing bus call X-Git-Tag: v256-rc1~656^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67648678b0dafd09db09c12918e52a5fb745180f;p=thirdparty%2Fsystemd.git hostnamectl: properly initialize the two timestamp fields before doing bus call Otherwise if talking to an old hostnamed (which doesn't have these fields) we'd assume the timestamp is valid even though it isn't and show garbage. --- diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c index a70c9572910..5e1cbd373d6 100644 --- a/src/hostname/hostnamectl.c +++ b/src/hostname/hostnamectl.c @@ -236,7 +236,7 @@ static int print_status_info(StatusInfo *i) { return table_log_add_error(r); } - if (i->os_support_end != USEC_INFINITY) { + if (timestamp_is_set(i->os_support_end)) { usec_t n = now(CLOCK_REALTIME); r = table_add_many(table, @@ -362,6 +362,8 @@ static int get_one_name(sd_bus *bus, const char* attr, char **ret) { static int show_all_names(sd_bus *bus) { StatusInfo info = { .vsock_cid = VMADDR_CID_ANY, + .os_support_end = USEC_INFINITY, + .firmware_date = USEC_INFINITY, }; static const struct bus_properties_map hostname_map[] = {