summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/busctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-bus/busctl.c')
-rw-r--r--src/libsystemd-bus/busctl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsystemd-bus/busctl.c b/src/libsystemd-bus/busctl.c
index 7649be29f4..f557e50036 100644
--- a/src/libsystemd-bus/busctl.c
+++ b/src/libsystemd-bus/busctl.c
@@ -82,7 +82,6 @@ static int list_bus_names(sd_bus *bus, char **argv) {
STRV_FOREACH(i, l) {
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
- _cleanup_free_ char *owner = NULL;
sd_id128_t mid;
if (arg_no_unique && (*i)[0] == ':')
@@ -94,8 +93,9 @@ static int list_bus_names(sd_bus *bus, char **argv) {
printf("%-*s", (int) max_i, *i);
- r = sd_bus_get_owner(bus, *i, SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_COMM, &owner, &creds);
+ r = sd_bus_get_owner(bus, *i, SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_COMM|SD_BUS_CREDS_UNIQUE_NAME, &creds);
if (r >= 0) {
+ const char *unique;
pid_t pid;
uid_t uid;
@@ -124,8 +124,9 @@ static int list_bus_names(sd_bus *bus, char **argv) {
} else
fputs(" - ", stdout);
- if (owner)
- printf(" %-20s", owner);
+ r = sd_bus_creds_get_unique_name(creds, &unique);
+ if (r >= 0)
+ printf(" %-20s", unique);
else
fputs(" - ", stdout);