See attached patch.
>From 59aa82b74793e0fea438c3d328687791161bef68 Mon Sep 17 00:00:00 2001
From: sin <[email protected]>
Date: Tue, 11 Nov 2014 18:29:11 +0000
Subject: [PATCH] Call _exit() instead of exit() if exec*() fails

exit() will also unwind the atexit() functions.  This is bad
because if exec*() fails the process is in an inconsistent state.
---
 st.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/st.c b/st.c
index 068fbb3..4499be6 100644
--- a/st.c
+++ b/st.c
@@ -1190,7 +1190,7 @@ execsh(void) {
        signal(SIGALRM, SIG_DFL);
 
        execvp(prog, args);
-       exit(EXIT_FAILURE);
+       _exit(EXIT_FAILURE);
 }
 
 void
-- 
2.1.3

Reply via email to