mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +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: https://github.com/SerenityOS/serenity/commit/039e529dbe8 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);
|
||||
}
|
||||
|
||||
if (g_interrupted) {
|
||||
signal(SIGINT, SIG_DFL);
|
||||
signal(SIGINT, SIG_DFL);
|
||||
if (g_interrupted)
|
||||
raise(SIGINT);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue