chiark / gitweb /
udev: don't ignore non-encrypted block devices with no superblock
[elogind.git] / src / cgroup-util.c
index ccc94f86a1fc3eb4c70da24675fca9f742f23763..b68b9ad3a33a20c9c85e2e0c7a5d495e3f7cb71a 100644 (file)
@@ -188,7 +188,7 @@ int cg_kill(const char *controller, const char *path, int sig, bool ignore_self,
         my_pid = getpid();
 
         do {
-                pid_t pid;
+                pid_t pid = 0;
                 done = true;
 
                 if ((r = cg_enumerate_processes(controller, path, &f)) < 0) {
@@ -321,16 +321,17 @@ int cg_kill_recursive_and_wait(const char *controller, const char *path, bool re
         assert(controller);
 
         /* This safely kills all processes; first it sends a SIGTERM,
-         * then checks 8 times after 50ms whether the group is
-         * now empty, and finally kills everything that is left with
-         * SIGKILL */
+         * then checks 8 times after 200ms whether the group is now
+         * empty, then kills everything that is left with SIGKILL and
+         * finally checks 5 times after 200ms each whether the group
+         * is finally empty. */
 
-        for (i = 0; i < 10; i++) {
+        for (i = 0; i < 15; i++) {
                 int sig, r;
 
                 if (i <= 0)
                         sig = SIGTERM;
-                else if (i >= 9)
+                else if (i == 9)
                         sig = SIGKILL;
                 else
                         sig = 0;
@@ -338,7 +339,7 @@ int cg_kill_recursive_and_wait(const char *controller, const char *path, bool re
                 if ((r = cg_kill_recursive(controller, path, sig, true, rem, NULL)) <= 0)
                         return r;
 
-                usleep(50 * USEC_PER_MSEC);
+                usleep(200 * USEC_PER_MSEC);
         }
 
         return 0;
@@ -361,7 +362,7 @@ int cg_migrate(const char *controller, const char *from, const char *to, bool ig
         my_pid = getpid();
 
         do {
-                pid_t pid;
+                pid_t pid = 0;
                 done = true;
 
                 if ((r = cg_enumerate_tasks(controller, from, &f)) < 0) {
@@ -781,9 +782,9 @@ finish:
 }
 
 int cg_is_empty(const char *controller, const char *path, bool ignore_self) {
-        pid_t pid;
+        pid_t pid = 0;
         int r;
-        FILE *f;
+        FILE *f = NULL;
         bool found = false;
 
         assert(controller);