diff options
Diffstat (limited to 'src/stdlib/system.c')
| -rw-r--r-- | src/stdlib/system.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/stdlib/system.c b/src/stdlib/system.c index ac0d54d5..612a9570 100644 --- a/src/stdlib/system.c +++ b/src/stdlib/system.c @@ -20,6 +20,9 @@ int system(const char * string) return 0; } + /* ignore SIGINT and SIGQUIT */ + /* block SIGCHLD */ + pid = fork(); if (pid < 0) { /* errno comes from fork() */ @@ -27,13 +30,19 @@ int system(const char * string) } if (pid == 0) { + /* restore signal handlers */ execl("/bin/sh", "sh", "-c", string, (char *)0); - _exit(1); + _exit(127); } if (waitpid(pid, &status, 0) == -1) { errno = ECHILD; - return -1; + status = -1; + } + + /* restore signal handlers */ + if (WIFSIGNALED(status)) { + } return status; |
