From: Lennart Poettering Date: Wed, 22 Feb 2023 12:42:02 +0000 (+0100) Subject: systemctl: suppress timeout display if unset in list-automounts X-Git-Tag: v254-rc1~1189^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=21ae8c17d468ca8407cb888e4531a7b484b96daf;p=thirdparty%2Fsystemd.git systemctl: suppress timeout display if unset in list-automounts If the timeout is zero it's not set, let's suppress the output then. --- diff --git a/src/systemctl/systemctl-list-units.c b/src/systemctl/systemctl-list-units.c index 93dd4b7dfd2..131553d96ec 100644 --- a/src/systemctl/systemctl-list-units.c +++ b/src/systemctl/systemctl-list-units.c @@ -855,9 +855,18 @@ static int output_automounts_list(struct automount_info *infos, size_t n_infos) r = table_add_many(table, TABLE_STRING, info->what, TABLE_STRING, info->where, - TABLE_BOOLEAN, info->mounted, - TABLE_TIMESPAN_MSEC, info->timeout_idle_usec, - TABLE_STRING, unit); + TABLE_BOOLEAN, info->mounted); + if (r < 0) + return table_log_add_error(r); + + if (timestamp_is_set(info->timeout_idle_usec)) + r = table_add_cell(table, NULL, TABLE_TIMESPAN_MSEC, &info->timeout_idle_usec); + else + r = table_add_cell(table, NULL, TABLE_EMPTY, NULL); + if (r < 0) + return table_log_add_error(r); + + r = table_add_cell(table, NULL, TABLE_STRING, unit); if (r < 0) return table_log_add_error(r); }