summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2021-04-26 22:03:19 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-15 19:46:56 +0200
commit45f0963f2466475876ee0f6f11b3e81de04aab19 (patch)
treeaaa6afbcf2ea304a60204fe7bd09128b7727b096
parent6c177c530027262aa87cfb026dd5537859d2ff8e (diff)
downloadsystemd-45f0963f2466475876ee0f6f11b3e81de04aab19.tar.gz
systemctl: hide some empty properties without --all
Fixes: #19423 (cherry picked from commit 1ceaad69378272c64da4ecaab0d59ebb7a92ca0a) (cherry picked from commit af3a3dd2f1360973560d21d1aeec9531e953162a)
-rw-r--r--src/shared/bus-print-properties.c6
-rw-r--r--src/systemctl/systemctl-show.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/shared/bus-print-properties.c b/src/shared/bus-print-properties.c
index 4cea25073d..055a89991b 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 d5efecbe65..5812989c76 100644
--- a/src/systemctl/systemctl-show.c
+++ b/src/systemctl/systemctl-show.c
@@ -1424,7 +1424,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;
@@ -1625,7 +1626,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")) {