From 21ae8c17d468ca8407cb888e4531a7b484b96daf Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 22 Feb 2023 13:42:02 +0100 Subject: systemctl: suppress timeout display if unset in list-automounts If the timeout is zero it's not set, let's suppress the output then. --- src/systemctl/systemctl-list-units.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/systemctl/systemctl-list-units.c b/src/systemctl/systemctl-list-units.c index 93dd4b7dfd..131553d96e 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); } -- cgit v1.2.3