shared/bus-util: format uid==-1 and gid==-1 as [not set]

$ systemctl show systemd-journald -p UID,GID
UID=4294967295
GID=4294967295

↓

$ systemctl show systemd-journald -p UID,GID
UID=[not set]
GID=[not set]

Just seeing the number is very misleading.

Fixes #6511.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-09-25 11:23:59 +02:00
parent 6088cefb21
commit c533658a1c
+11 -1
View File
@@ -809,7 +809,17 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b
if (strstr(name, "UMask") || strstr(name, "Mode"))
print_property(name, "%04o", u);
else
else if (streq(name, "UID")) {
if (u == UID_INVALID)
print_property(name, "%s", "[not set]");
else
print_property(name, "%"PRIu32, u);
} else if (streq(name, "GID")) {
if (u == GID_INVALID)
print_property(name, "%s", "[not set]");
else
print_property(name, "%"PRIu32, u);
} else
print_property(name, "%"PRIu32, u);
return 1;