names: rework list logic once more
authorDaniel Mack <zonque@gmail.com>
Sat, 21 Dec 2013 23:46:37 +0000 (00:46 +0100)
committerDaniel Mack <zonque@gmail.com>
Sat, 21 Dec 2013 23:47:35 +0000 (00:47 +0100)
now, KDBUS_NAME_LIST_ACTIVATORS will list name entries regardless
whether they have been activated or not.

names.c

diff --git a/names.c b/names.c
index 3858e5d1c2cebb4c9d394053f1feecfd5e98c229..ca5f200be182df3853c221b0a32d6c9e35ca17ec 100644 (file)
--- a/names.c
+++ b/names.c
@@ -724,17 +724,12 @@ static int kdbus_name_list_all(struct kdbus_conn *conn, u64 flags,
 
                /* all names the connection owns */
                if (flags & KDBUS_NAME_LIST_NAMES ||
-                   c->flags & KDBUS_HELLO_ACTIVATOR) {
+                   flags & KDBUS_NAME_LIST_ACTIVATORS) {
                        struct kdbus_name_entry *e;
 
                        list_for_each_entry(e, &c->names_list, conn_entry) {
                                struct kdbus_conn *a = e->activator;
 
-                               ret = kdbus_name_list_write(conn, c, &p,
-                                                           e, write);
-                               if (ret < 0)
-                                       return ret;
-
                                if ((flags & KDBUS_NAME_LIST_ACTIVATORS) &&
                                    a && a != c) {
                                        ret = kdbus_name_list_write(conn, a, &p,
@@ -743,6 +738,14 @@ static int kdbus_name_list_all(struct kdbus_conn *conn, u64 flags,
                                                return ret;
                                }
 
+                               if (flags & KDBUS_NAME_LIST_NAMES ||
+                                   c->flags & KDBUS_HELLO_ACTIVATOR) {
+                                       ret = kdbus_name_list_write(conn, c, &p,
+                                                                   e, write);
+                                       if (ret < 0)
+                                               return ret;
+                               }
+
                                added = true;
                        }
                }