1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:37:34 +00:00

SystemServer: Correct logic for services exiting successfully

WIFEXITED() returns a bool, so previously we were setting
exited_successfully to true when the service was terminated by a signal,
and false if it exited, regardless of the exit status. To test the exit
status, we have to use WEXITSTATUS() instead.

This causes us to correctly use the "3 tries then give up" logic for
services that crash, instead of infinitely attempting to respawn them.
This commit is contained in:
Sam Atkins 2024-02-01 16:03:58 +00:00 committed by Sam Atkins
parent e269526020
commit 8a974ca91a

View file

@ -260,7 +260,7 @@ ErrorOr<void> Service::did_exit(int status)
return {}; return {};
auto run_time = m_run_timer.elapsed_time(); auto run_time = m_run_timer.elapsed_time();
bool exited_successfully = WIFEXITED(status) == 0; bool exited_successfully = WIFEXITED(status) && WEXITSTATUS(status) == 0;
if (!exited_successfully && run_time < 1_sec) { if (!exited_successfully && run_time < 1_sec) {
switch (m_restart_attempts) { switch (m_restart_attempts) {