]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: suppress timeout display if unset in list-automounts
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Feb 2023 12:42:02 +0000 (13:42 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 22 Feb 2023 18:00:42 +0000 (19:00 +0100)
If the timeout is zero it's not set, let's suppress the output then.

src/systemctl/systemctl-list-units.c

index 93dd4b7dfd2688c11afa139b6622a49b8f660086..131553d96ecc63233e748e4d48de6d272acffb0b 100644 (file)
@@ -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);
         }