mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:17:35 +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:
parent
e269526020
commit
8a974ca91a
1 changed files with 1 additions and 1 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue