chiark / gitweb /
bus: we now support path_namespace=/
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 10 Jun 2015 18:14:56 +0000 (20:14 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:01:50 +0000 (10:01 +0100)
Our bloom-filters support root-path matching. Make sure we properly add
the path_namespace= tag.

src/libelogind/sd-bus/bus-control.c
src/libelogind/sd-bus/test-bus-kernel-bloom.c

index c6d962129b1dd0db831985c018ae2e4362fa99bf..7a59702cb270ccb93d4e9bd5281eddfe10c7dee7 100644 (file)
@@ -1291,10 +1291,8 @@ int bus_add_match_internal_kernel(
                         break;
 
                 case BUS_MATCH_PATH_NAMESPACE:
-                        if (!streq(c->value_str, "/")) {
-                                bloom_add_pair(bloom, bus->bloom_size, bus->bloom_n_hash, "path-slash-prefix", c->value_str);
-                                using_bloom = true;
-                        }
+                        bloom_add_pair(bloom, bus->bloom_size, bus->bloom_n_hash, "path-slash-prefix", c->value_str);
+                        using_bloom = true;
                         break;
 
                 case BUS_MATCH_ARG...BUS_MATCH_ARG_LAST: {
index 01f784f8c232b4d6fbb624538ed79d6bb46089d2..90eb1f2a3350d98ea714034077e6c8c8bdc1bc11 100644 (file)
@@ -123,6 +123,7 @@ int main(int argc, char *argv[]) {
         test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path_namespace='/foo'", true);
         test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path_namespace='/'", true);
         test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path_namespace='/quux'", false);
+        test_one("/", "waldo.com", "Piep", false, "foobar", "path_namespace='/'", true);
 
         test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path='/foo/bar/waldo/'", false);
         test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path='/foo/'", false);