]> err.no Git - systemd/commitdiff
service: rework logic when we consider a service running
authorLennart Poettering <lennart@poettering.net>
Tue, 22 Jun 2010 02:09:50 +0000 (04:09 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 22 Jun 2010 02:09:50 +0000 (04:09 +0200)
src/service.c

index aff355112dbd342ce3d256e8c3aa1aaf2e5bd68b..e1dab70f816eb2a9ccb8b67e4ad0e2455c1d8440 100644 (file)
@@ -1587,13 +1587,16 @@ fail:
 }
 
 static void service_enter_running(Service *s, bool success) {
+        int main_pid_ok, cgroup_ok;
         assert(s);
 
         if (!success)
                 s->failure = true;
 
-        if (main_pid_good(s) != 0 &&
-            cgroup_good(s) != 0 &&
+        main_pid_ok = main_pid_good(s);
+        cgroup_ok = cgroup_good(s);
+
+        if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) &&
             (s->bus_name_good || s->type != SERVICE_DBUS))
                 service_set_state(s, SERVICE_RUNNING);
         else if (s->valid_no_process)