chiark / gitweb /
socket: fix D-Bus introspection data
[elogind.git] / src / service.c
index aff355112dbd342ce3d256e8c3aa1aaf2e5bd68b..3102acc0860d3d4516d4fbb18086abc5ac1aad35 100644 (file)
@@ -83,8 +83,8 @@ static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
         [SERVICE_STOP_POST] = UNIT_DEACTIVATING,
         [SERVICE_FINAL_SIGTERM] = UNIT_DEACTIVATING,
         [SERVICE_FINAL_SIGKILL] = UNIT_DEACTIVATING,
-        [SERVICE_MAINTENANCE] = UNIT_INACTIVE,
-        [SERVICE_AUTO_RESTART] = UNIT_ACTIVATING,
+        [SERVICE_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE,
+        [SERVICE_AUTO_RESTART] = UNIT_ACTIVATING
 };
 
 static void service_init(Unit *u) {
@@ -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)