chiark / gitweb /
core: uninstall cgroup agent only if we are running outside of a container
[elogind.git] / src / core / main.c
index efc5791bbc9ff12893e4a60b3117254cd5e030e7..0ba1d15033253379a4240920054545d88284fc2a 100644 (file)
@@ -1943,9 +1943,11 @@ finish:
                         watchdog_close(true);
                 }
 
-                /* avoid the creation of new processes forked by the kernel; at this
-                 * point, we will not listen to the signals anyway */
-                cg_uninstall_release_agent(SYSTEMD_CGROUP_CONTROLLER);
+                /* Avoid the creation of new processes forked by the
+                 * kernel; at this point, we will not listen to the
+                 * signals anyway */
+                if (detect_container(NULL) <= 0)
+                        cg_uninstall_release_agent(SYSTEMD_CGROUP_CONTROLLER);
 
                 execve(SYSTEMD_SHUTDOWN_BINARY_PATH, (char **) command_line, env_block);
                 free(env_block);