Remove cgroup before reporting process being finished
authorJagger <robert@swiecki.net>
Sun, 19 Jun 2016 14:02:00 +0000 (16:02 +0200)
committerJagger <robert@swiecki.net>
Sun, 19 Jun 2016 14:02:00 +0000 (16:02 +0200)
subproc.c

index 8b7b7abd6baaaf0dc50db9d9feb5da0551710c5b..05db4330f0bda4e4b30d988e3ed6aa84a75fe069 100644 (file)
--- a/subproc.c
+++ b/subproc.c
@@ -213,6 +213,7 @@ int subprocReap(struct nsjconf_t *nsjconf)
                }
 
                if (wait4(si.si_pid, &status, WNOHANG, NULL) == si.si_pid) {
+                       cgroupFinishFromParent(nsjconf, si.si_pid);
                        if (WIFEXITED(status)) {
                                subprocRemove(nsjconf, si.si_pid);
                                LOG_I("PID: %d exited with status: %d, (PIDs left: %d)", si.si_pid,
@@ -228,7 +229,6 @@ int subprocReap(struct nsjconf_t *nsjconf)
                                      si.si_pid, WTERMSIG(status), subprocCount(nsjconf));
                                rv = 100 + WTERMSIG(status);
                        }
-                       cgroupFinishFromParent(nsjconf, si.si_pid);
                }
        }