]> git.armaanb.net Git - st.git/commitdiff
replace exit(3) by _exit(2) in signal handler sigchld()
authorJan Klemkow <j.klemkow@wemelug.de>
Wed, 29 Apr 2020 22:10:02 +0000 (00:10 +0200)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Wed, 29 Apr 2020 23:21:21 +0000 (01:21 +0200)
exit(3) is not async-signal-safe but, _exit(2) is.
This change prevents st to crash and dump core.

st.c

diff --git a/st.c b/st.c
index 0ce6ac24591968723c7b70e5cb0af992df8e67b5..2bf133f4ad99686b1c34f08c0dfa9ad1027f2840 100644 (file)
--- a/st.c
+++ b/st.c
@@ -730,7 +730,7 @@ sigchld(int a)
                die("child exited with status %d\n", WEXITSTATUS(stat));
        else if (WIFSIGNALED(stat))
                die("child terminated due to signal %d\n", WTERMSIG(stat));
                die("child exited with status %d\n", WEXITSTATUS(stat));
        else if (WIFSIGNALED(stat))
                die("child terminated due to signal %d\n", WTERMSIG(stat));
-       exit(0);
+       _exit(0);
 }
 
 void
 }
 
 void