summaryrefslogtreecommitdiff
path: root/src/stdlib/quick_exit.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-01-31 01:19:23 -0500
committerJakob Kaivo <jkk@ung.org>2024-01-31 01:19:23 -0500
commit0f649efceacd8f9eb921d5765dfa73b0771b1fcd (patch)
treefaadaeae5c3277435d97650fcc22be5203e17c35 /src/stdlib/quick_exit.c
parent28a7e3dfb4ca2bd407508ef789bf1859acd9b969 (diff)
use a single variable for tracking exit calls
Diffstat (limited to 'src/stdlib/quick_exit.c')
-rw-r--r--src/stdlib/quick_exit.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/stdlib/quick_exit.c b/src/stdlib/quick_exit.c
index 3d754604..9ad6780e 100644
--- a/src/stdlib/quick_exit.c
+++ b/src/stdlib/quick_exit.c
@@ -7,23 +7,23 @@ _Noreturn void quick_exit(int status)
{
SIGNAL_SAFE(1);
- if (__stdlib.quick_exit_called) {
+ if (__stdlib.exit_called == QUICK) {
__stdlib.constraint_handler("Undefined behavior: quick_exit() called twice", NULL, 0);
- }
- if (__stdlib.exit_called) {
+ }
+ if (__stdlib.exit_called) {
__stdlib.constraint_handler("Undefined behavior: quick_exit() called after exit", NULL, 0);
- }
- __stdlib.quick_exit_called = 1;
+ }
+ __stdlib.exit_called = QUICK;
/* execute all at_quick_exit() registered functions in reverse order */
struct atexit *ae = &(__stdlib.at_quick_exit);
- while (ae) {
- int i = ae->nfns;
- while (i > 0) {
- ae->fns[--i]();
- }
- ae = ae->prev;
- }
+ while (ae) {
+ int i = ae->nfns;
+ while (i > 0) {
+ ae->fns[--i]();
+ }
+ ae = ae->prev;
+ }
fflush(NULL);
// fclose(all the things);