Jelajahi Sumber

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.
sin 10 tahun lalu
induk
melakukan
4418939dd9
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      st.c

+ 1 - 1
st.c

@@ -1190,7 +1190,7 @@ execsh(void) {
 	signal(SIGALRM, SIG_DFL);
 
 	execvp(prog, args);
-	exit(EXIT_FAILURE);
+	_exit(EXIT_FAILURE);
 }
 
 void