]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup-util: debug log if /proc/self/ns/cgroup is not available for unexpected reasons
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Oct 2018 15:25:11 +0000 (17:25 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 26 Oct 2018 16:43:34 +0000 (18:43 +0200)
src/basic/cgroup-util.c

index 19723d30843cd457ac4e6ebf388e2cb07c9ca762..65ca6f2f504b81a471bf3ef43ea179a968a52192 100644 (file)
@@ -129,10 +129,12 @@ bool cg_ns_supported(void) {
         if (enabled >= 0)
                 return enabled;
 
-        if (access("/proc/self/ns/cgroup", F_OK) == 0)
-                enabled = 1;
-        else
-                enabled = 0;
+        if (access("/proc/self/ns/cgroup", F_OK) < 0) {
+                if (errno != ENOENT)
+                        log_debug_errno(errno, "Failed to check whether /proc/self/ns/cgroup is available, assuming not: %m");
+                enabled = false;
+        } else
+                enabled = true;
 
         return enabled;
 }