chiark / gitweb /
mount: do not try to mount disable cgroup controllers
[elogind.git] / src / mount-setup.c
index 6efc48e4dce8c493e669442ff1ee479b4ffd1d99..7eb806e7fd8588d3d7fa23965716f130448e0576 100644 (file)
@@ -138,8 +138,9 @@ static int mount_cgroup_controllers(void) {
         for (;;) {
                 MountPoint p;
                 char *controller, *where;
+                int enabled = false;
 
-                if (fscanf(f, "%ms %*i %*i %*i", &controller) != 1) {
+                if (fscanf(f, "%ms %*i %*i %i", &controller, &enabled) != 1) {
 
                         if (feof(f))
                                 break;
@@ -149,6 +150,11 @@ static int mount_cgroup_controllers(void) {
                         goto finish;
                 }
 
+                if (!enabled) {
+                        free(controller);
+                        continue;
+                }
+
                 if (asprintf(&where, "/sys/fs/cgroup/%s", controller) < 0) {
                         free(controller);
                         r = -ENOMEM;
@@ -212,7 +218,7 @@ static int nftw_cb(
 
 int mount_setup(void) {
 
-        const char *symlinks =
+        const char symlinks[] =
                 "/proc/kcore\0"      "/dev/core\0"
                 "/proc/self/fd\0"    "/dev/fd\0"
                 "/proc/self/fd/0\0"  "/dev/stdin\0"