chiark / gitweb /
cg_shift_path(): Do not shift if cgroup and root are equal
[elogind.git] / src / basic / cgroup-util.c
index 98a353ddb079af1b6d23762613d0a1cb5a46f703..f7a892380a7e4975dd439ca22e0470e251ca6c70 100644 (file)
@@ -1203,10 +1203,11 @@ int cg_shift_path(const char *cgroup, const char *root, const char **shifted) {
                         return r;
 
                 root = rt;
+                log_debug_elogind("Determined root path: \"%s\"", root);
         }
 
         p = path_startswith(cgroup, root);
-        if (p && p > cgroup)
+        if (p && p[0] && (p > cgroup))
                 *shifted = p - 1;
         else
                 *shifted = cgroup;