chiark / gitweb /
bus: properly shift cgroup data returned from kdbus by the container's root before...
[elogind.git] / src / libsystemd-bus / bus-control.c
index 55986f349b4da51e47af82ec262400febb68ab58..511ca20ee3b4e614ef135dbeef12c99297abb3ff 100644 (file)
@@ -33,6 +33,7 @@
 #include "bus-control.h"
 #include "bus-bloom.h"
 #include "bus-util.h"
+#include "cgroup-util.h"
 
 _public_ int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
         int r;
@@ -489,6 +490,18 @@ static int bus_get_owner_kdbus(
                                         goto fail;
                                 }
 
+                                if (!bus->cgroup_root) {
+                                        r = cg_get_root_path(&bus->cgroup_root);
+                                        if (r < 0)
+                                                goto fail;
+                                }
+
+                                c->cgroup_root = strdup(bus->cgroup_root);
+                                if (!c->cgroup_root) {
+                                        r = -ENOMEM;
+                                        goto fail;
+                                }
+
                                 c->mask |= m;
                         }
                         break;