chiark / gitweb /
sd-bus: fix object tree to be deeper than 2 levels
[elogind.git] / src / libelogind / sd-bus / bus-objects.c
index b3cc28ee9bc57ee05db3a6d4b4a0565a55541842..cbdf6552f981caab1f48c3091de9623073c8459a 100644 (file)
@@ -1416,7 +1416,7 @@ static struct node *bus_node_allocate(sd_bus *bus, const char *path) {
                 e = strrchr(path, '/');
                 assert(e);
 
-                p = strndupa(path, MAX(1, path - e));
+                p = strndupa(path, MAX(1, e - path));
 
                 parent = bus_node_allocate(bus, p);
                 if (!parent)