From 8a974ca91aae66ff39a25739877140421bc354a3 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 1 Feb 2024 16:03:58 +0000 Subject: [PATCH] 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. --- Userland/Services/SystemServer/Service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index 12d98e0a1b..421acc7007 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -260,7 +260,7 @@ ErrorOr Service::did_exit(int status) return {}; 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) { switch (m_restart_attempts) {