From: Frantisek Sumsal Date: Mon, 26 Apr 2021 20:03:19 +0000 (+0200) Subject: systemctl: hide some empty properties without --all X-Git-Tag: v249-rc1~340 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ceaad69378272c64da4ecaab0d59ebb7a92ca0a;p=thirdparty%2Fsystemd.git systemctl: hide some empty properties without --all Fixes: #19423 --- diff --git a/src/shared/bus-print-properties.c b/src/shared/bus-print-properties.c index 2a712be7339..b4fe8bb0381 100644 --- a/src/shared/bus-print-properties.c +++ b/src/shared/bus-print-properties.c @@ -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) || diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c index 1a0bd35617d..dc45de4b3d5 100644 --- a/src/systemctl/systemctl-show.c +++ b/src/systemctl/systemctl-show.c @@ -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")) {