Skip to content

Commit 5c2b288

Browse files
N-R-Kvapier
authored andcommitted
pipes: use _exit instead
it's generally advisable to use `_exit` rather than `exit` from forked child to avoid triggering things like `atexit` handlers and whatnot.
1 parent 6356e34 commit 5c2b288

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/shared/pipes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ int rc_pipe_command(char *cmd)
4646
close(pfd[pipe_write_end]);
4747
if (pfd[pipe_read_end] != STDIN_FILENO) {
4848
if (dup2(pfd[pipe_read_end], STDIN_FILENO) < 0)
49-
exit(1);
49+
_exit(1);
5050
close(pfd[pipe_read_end]);
5151
}
5252
execl("/bin/sh", "sh", "-c", cmd, NULL);
53-
exit(1);
53+
_exit(1);
5454
} else {
5555
/* error */
5656
close(pfd[pipe_read_end]);

0 commit comments

Comments
 (0)