From c533658a1c2f6a62e437117f37ce5ecdfd11a695 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 25 Sep 2017 11:23:59 +0200 Subject: [PATCH] shared/bus-util: format uid==-1 and gid==-1 as [not set] MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit $ 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 48752c5fea4..a9a763c1cab 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -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; -- 2.39.2