if (r < 0)
return r;
- return !r;
+ return r == 0;
}
static bool service_shall_restart(Service *s) {
case SERVICE_STOP_SIGTERM:
case SERVICE_STOP_SIGKILL:
- if (main_pid_good(s) <= 0 && !control_pid_good(s))
+ if (main_pid_good(s) <= 0 && control_pid_good(s) <= 0)
service_enter_stop_post(s, SERVICE_SUCCESS);
break;
case SERVICE_STOP_POST:
case SERVICE_FINAL_SIGTERM:
case SERVICE_FINAL_SIGKILL:
- if (main_pid_good(s) <= 0 && !control_pid_good(s))
+ if (main_pid_good(s) <= 0 && control_pid_good(s) <= 0)
service_enter_dead(s, SERVICE_SUCCESS, true);
break;
case SERVICE_STOP_SIGTERM:
case SERVICE_STOP_SIGKILL:
- if (!control_pid_good(s))
+ if (control_pid_good(s) <= 0)
service_enter_stop_post(s, f);
/* If there is still a control process, wait for that first */
case SERVICE_FINAL_SIGTERM:
case SERVICE_FINAL_SIGKILL:
- if (!control_pid_good(s))
+ if (control_pid_good(s) <= 0)
service_enter_dead(s, f, true);
break;
r = service_load_pid_file(s, !has_start_post);
if (!has_start_post && r < 0) {
r = service_demand_pid_file(s);
- if (r < 0 || !cgroup_good(s))
+ if (r < 0 || cgroup_good(s) == 0)
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_PROTOCOL);
break;
}
r = service_load_pid_file(s, true);
if (r < 0) {
r = service_demand_pid_file(s);
- if (r < 0 || !cgroup_good(s))
+ if (r < 0 || cgroup_good(s) == 0)
service_enter_stop(s, SERVICE_FAILURE_PROTOCOL);
break;
}