]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udevd: decrease indentation
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Nov 2018 06:58:41 +0000 (15:58 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Nov 2018 14:53:50 +0000 (23:53 +0900)
src/udev/udevd.c

index 0aec3acd07fdb9940eee9548133fd6e089f630bd..9ab10d9d6f9ebaf107b969b245ced2e3f617a4b9 100644 (file)
@@ -1270,28 +1270,30 @@ static int on_sigchld(sd_event_source *s, const struct signalfd_siginfo *si, voi
 
 static int on_post(sd_event_source *s, void *userdata) {
         Manager *manager = userdata;
-        int r;
 
         assert(manager);
 
-        if (LIST_IS_EMPTY(manager->events)) {
-                /* no pending events */
-                if (!hashmap_isempty(manager->workers)) {
-                        /* there are idle workers */
-                        log_debug("cleanup idle workers");
-                        manager_kill_workers(manager);
-                } else {
-                        /* we are idle */
-                        if (manager->exit) {
-                                r = sd_event_exit(manager->event, 0);
-                                if (r < 0)
-                                        return r;
-                        } else if (manager->cgroup)
-                                /* cleanup possible left-over processes in our cgroup */
-                                cg_kill(SYSTEMD_CGROUP_CONTROLLER, manager->cgroup, SIGKILL, CGROUP_IGNORE_SELF, NULL, NULL, NULL);
-                }
+        if (!LIST_IS_EMPTY(manager->events))
+                return 1;
+
+        /* There are no pending events. Let's cleanup idle process. */
+
+        if (!hashmap_isempty(manager->workers)) {
+                /* There are idle workers */
+                log_debug("Cleanup idle workers");
+                manager_kill_workers(manager);
+                return 1;
         }
 
+        /* There are no idle workers. */
+
+        if (manager->exit)
+                return sd_event_exit(manager->event, 0);
+
+        if (manager->cgroup)
+                /* cleanup possible left-over processes in our cgroup */
+                (void) cg_kill(SYSTEMD_CGROUP_CONTROLLER, manager->cgroup, SIGKILL, CGROUP_IGNORE_SELF, NULL, NULL, NULL);
+
         return 1;
 }