mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 17:16:04 +00:00
Userland: Fix a signal race condition
It has been possible for a signal to arrive in between us checking g_interrupted and exiting - sucessfully, even though we were interrupted. This way, if a signal arrives before we reset the disposition, we will reliably check for it later; if it arrives afterwards, it'll kill us automatically.
This commit is contained in:
parent
0055a28710
commit
039e529dbe
Notes:
sideshowbarker
2024-07-19 02:47:36 +09:00
Author: https://github.com/bugaevc
Commit: 039e529dbe
Pull-request: https://github.com/SerenityOS/serenity/pull/3450
1 changed files with 2 additions and 3 deletions
|
@ -59,10 +59,9 @@ int main(int argc, char** argv)
|
||||||
printf("Sleep interrupted with %u seconds remaining.\n", remaining);
|
printf("Sleep interrupted with %u seconds remaining.\n", remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_interrupted) {
|
signal(SIGINT, SIG_DFL);
|
||||||
signal(SIGINT, SIG_DFL);
|
if (g_interrupted)
|
||||||
raise(SIGINT);
|
raise(SIGINT);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue