diff options
author | Djalal Harouni <tixxdz@opendz.org> | 2016-11-15 15:15:37 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-07-17 17:58:35 +0200 |
commit | 9a607c42cc952ff9e45e639de4646772a940b4d4 (patch) | |
tree | b8045183a70431e2a39a3552fc090954a320571d /src/shared | |
parent | 95d379d7f7191323ff53adb0a7861edc231b2442 (diff) |
bus-util: print RestrictNamespaces= as a string
Allow all callers that want to print RestrictNamespaces= returned from D-Bus
as a string instead of a u64 value.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bus-util.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 0d64ec196..2d1b3b965 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -773,6 +773,23 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b char timespan[FORMAT_TIMESPAN_MAX]; print_property(name, "%s", format_timespan(timespan, sizeof(timespan), u, 0)); + } else if (streq(name, "RestrictNamespaces")) { + _cleanup_free_ char *s = NULL; + const char *result = NULL; + + if ((u & NAMESPACE_FLAGS_ALL) == 0) + result = "yes"; + else if ((u & NAMESPACE_FLAGS_ALL) == NAMESPACE_FLAGS_ALL) + result = "no"; + else { + r = namespace_flag_to_string_many(u, &s); + if (r < 0) + return r; + + result = s; + } + + print_property(name, "%s", result); } else print_property(name, "%"PRIu64, u); |