chiark / gitweb /
nspawn: set up a kdbus namespace when starting a container
[elogind.git] / src / libsystemd-bus / busctl.c
index 4d4f38e0a80aefe06aafff60ccdef7059514a1d4..f557e5003630411424d68aea886ec293ca34b346 100644 (file)
@@ -82,16 +82,20 @@ 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] == ':')
                         continue;
 
+                /* Skip the bus driver */
+                if (streq(*i, "org.freedesktop.DBus"))
+                        continue;
+
                 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;
 
@@ -120,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);
 
@@ -227,8 +232,8 @@ static int help(void) {
                "  -M --machine=CONTAINER  Operate on local container\n"
                "     --address=ADDRESS    Connect to bus specified by address\n"
                "     --no-unique          Only show well-known names\n"
-               "     --no-machine         Don't show machine ID column in list\n\n"
-               "     --match=MATCH        Only show matching messages\n"
+               "     --no-machine         Don't show machine ID column in list\n"
+               "     --match=MATCH        Only show matching messages\n\n"
                "Commands:\n"
                "  list                    List bus names\n"
                "  monitor [SERVICE...]    Show bus traffic\n",