summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/busctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-30 04:14:10 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-30 14:46:14 +0100
commit49b832c5b810f4d8bb59249ff25472fd670503dc (patch)
treeff71bd5e8318578db77f85d21843a273b60fce4b /src/libsystemd-bus/busctl.c
parent2377ae1ff6ee2987a300d4df17320c2d9c61d23d (diff)
bus: include unique and well known names in credentials object
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);