]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: hide some empty properties without --all
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 26 Apr 2021 20:03:19 +0000 (22:03 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 Apr 2021 03:16:50 +0000 (12:16 +0900)
Fixes: #19423
src/shared/bus-print-properties.c
src/systemctl/systemctl-show.c

index 2a712be7339fc936a4d1926f9b9badce55ccc9eb..b4fe8bb0381323f0bad71b448951b3c53e4204e3 100644 (file)
@@ -166,7 +166,8 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
                         if (!result)
                                 return -EINVAL;
 
-                        bus_print_property_value(name, expected_value, value, result);
+                        if (all || !isempty(result))
+                                bus_print_property_value(name, expected_value, value, result);
 
                 } else if (STR_IN_SET(name, "CapabilityBoundingSet", "AmbientCapabilities")) {
                         _cleanup_free_ char *s = NULL;
@@ -175,7 +176,8 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
                         if (r < 0)
                                 return r;
 
-                        bus_print_property_value(name, expected_value, value, s);
+                        if (all || !isempty(s))
+                                bus_print_property_value(name, expected_value, value, s);
 
                 } else if ((STR_IN_SET(name, "CPUWeight", "StartupCPUWeight", "IOWeight", "StartupIOWeight") && u == CGROUP_WEIGHT_INVALID) ||
                            (STR_IN_SET(name, "CPUShares", "StartupCPUShares") && u == CGROUP_CPU_SHARES_INVALID) ||
index 1a0bd35617da14f80004b7c02cb1b86fdc799dff..dc45de4b3d57c15244d8ed32f715977fbcb4cab6 100644 (file)
@@ -1425,7 +1425,8 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
                         if (n < 0)
                                 return log_oom();
 
-                        bus_print_property_value(name, expected_value, value, h);
+                        if (all || !isempty(h))
+                                bus_print_property_value(name, expected_value, value, h);
 
                         return 1;
 
@@ -1626,7 +1627,8 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
                         if (!affinity)
                                 return log_oom();
 
-                        bus_print_property_value(name, expected_value, value, affinity);
+                        if (all || !isempty(affinity))
+                                bus_print_property_value(name, expected_value, value, affinity);
 
                         return 1;
                 } else if (streq(name, "MountImages")) {