summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-02-22 13:42:02 +0100
committerLennart Poettering <lennart@poettering.net>2023-02-22 19:00:42 +0100
commit21ae8c17d468ca8407cb888e4531a7b484b96daf (patch)
tree58888ac6f643964350f717c540e3c735234f1ace
parentsystemctl: right-align left/passed columns in list-timers (diff)
downloadsystemd-21ae8c17d468ca8407cb888e4531a7b484b96daf.tar.xz
systemd-21ae8c17d468ca8407cb888e4531a7b484b96daf.zip
systemctl: suppress timeout display if unset in list-automounts
If the timeout is zero it's not set, let's suppress the output then.
Diffstat (limited to '')
-rw-r--r--src/systemctl/systemctl-list-units.c15
1 files 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);
}