summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-11-19 16:33:05 +0100
committerDaniel Mack <zonque@gmail.com>2013-11-29 14:06:50 +0100
commitb6bd53c1ee90338ceb83bf81cc11e81560561204 (patch)
tree43e73dfda43dbcbb8137681d4e380337ca415a97
parentb147398450c5719022a7b68721bebb9f2df48f29 (diff)
libsystemd-bus: make sd_bus_list_names return all connections, including unique names
-rw-r--r--src/libsystemd-bus/bus-control.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c
index f988cc7c59..eeeb77b591 100644
--- a/src/libsystemd-bus/bus-control.c
+++ b/src/libsystemd-bus/bus-control.c
@@ -195,6 +195,7 @@ _public_ int sd_bus_list_names(sd_bus *bus, char ***l) {
return -ENOMEM;
names->size = size;
+ names->flags = KDBUS_NAME_LIST_UNIQUE_NAMES;
r = ioctl(sd_bus_get_fd(bus), KDBUS_CMD_NAME_LIST, names);
if (r < 0) {
@@ -210,7 +211,14 @@ _public_ int sd_bus_list_names(sd_bus *bus, char ***l) {
}
KDBUS_PART_FOREACH(name, names, names) {
- r = strv_extend(&x, name->name);
+ char *n;
+
+ if (name->size > sizeof(*name))
+ n = name->name;
+ else
+ asprintf(&n, ":1.%llu", (unsigned long long) name->id);
+
+ r = strv_extend(&x, n);
if (r < 0)
return -ENOMEM;
}