]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/bus-util: format uid==-1 and gid==-1 as [not set] 6902/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 25 Sep 2017 09:23:59 +0000 (11:23 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 25 Sep 2017 09:23:59 +0000 (11:23 +0200)
$ 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.

src/shared/bus-util.c

index 48752c5fea4a3c7c5b8cf21ec00db741b786581c..a9a763c1cabecca5a7b74125a56cef3d12ad8ca9 100644 (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;