chiark / gitweb /
bus: never report nodes as children that do not have the right prefix
authorLennart Poettering <lennart@poettering.net>
Tue, 5 Nov 2013 20:24:33 +0000 (21:24 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 5 Nov 2013 20:24:33 +0000 (21:24 +0100)
src/libsystemd-bus/bus-objects.c

index 92781e9..93bd3ad 100644 (file)
@@ -114,12 +114,17 @@ static int add_enumerated_to_set(
                                 continue;
                         }
 
-                        if (!object_path_is_valid(*k) && object_path_startswith(*k, prefix)) {
+                        if (!object_path_is_valid(*k)){
                                 free(*k);
                                 r = -EINVAL;
                                 continue;
                         }
 
+                        if (!object_path_startswith(*k, prefix)) {
+                                free(*k);
+                                continue;
+                        }
+
                         r = set_consume(s, *k);
                 }
 
@@ -154,6 +159,9 @@ static int add_subtree_to_set(
         LIST_FOREACH(siblings, i, n->child) {
                 char *t;
 
+                if (!object_path_startswith(i->path, prefix))
+                        continue;
+
                 t = strdup(i->path);
                 if (!t)
                         return -ENOMEM;