names: fix 'added' assignment
authorDaniel Mack <zonque@gmail.com>
Sat, 21 Dec 2013 23:59:47 +0000 (00:59 +0100)
committerDaniel Mack <zonque@gmail.com>
Sat, 21 Dec 2013 23:59:47 +0000 (00:59 +0100)
names.c

diff --git a/names.c b/names.c
index ca5f200be182df3853c221b0a32d6c9e35ca17ec..182c363cb1e118afd8eff3b31bf246c2c1c1c1b2 100644 (file)
--- a/names.c
+++ b/names.c
@@ -723,8 +723,8 @@ static int kdbus_name_list_all(struct kdbus_conn *conn, u64 flags,
                        continue;
 
                /* all names the connection owns */
-               if (flags & KDBUS_NAME_LIST_NAMES ||
-                   flags & KDBUS_NAME_LIST_ACTIVATORS) {
+               if (flags & (KDBUS_NAME_LIST_NAMES |
+                            KDBUS_NAME_LIST_ACTIVATORS)) {
                        struct kdbus_name_entry *e;
 
                        list_for_each_entry(e, &c->names_list, conn_entry) {
@@ -736,6 +736,8 @@ static int kdbus_name_list_all(struct kdbus_conn *conn, u64 flags,
                                                                    e, write);
                                        if (ret < 0)
                                                return ret;
+
+                                       added = true;
                                }
 
                                if (flags & KDBUS_NAME_LIST_NAMES ||
@@ -744,9 +746,9 @@ static int kdbus_name_list_all(struct kdbus_conn *conn, u64 flags,
                                                                    e, write);
                                        if (ret < 0)
                                                return ret;
-                               }
 
-                               added = true;
+                                       added = true;
+                               }
                        }
                }