diff options
author | dim <dim@FreeBSD.org> | 2015-09-05 18:36:23 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-09-05 18:36:23 +0000 |
commit | fe74670889cf92661ccb26dc6bd31e8227b41594 (patch) | |
tree | c2636bec23985b92b33023a5ca2e324f89604bfa /lib/libc/stdlib/system.c | |
parent | 3cb87c6fdcce3fa2b08afc959741598eb31a8a5c (diff) | |
parent | 127f7b062779965375aa7d373ab56614a5d13f16 (diff) | |
download | FreeBSD-src-fe74670889cf92661ccb26dc6bd31e8227b41594.zip FreeBSD-src-fe74670889cf92661ccb26dc6bd31e8227b41594.tar.gz |
Merge ^/head r286858 through r287489.
Diffstat (limited to 'lib/libc/stdlib/system.c')
-rw-r--r-- | lib/libc/stdlib/system.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c index bd9ea5a..2b298e4 100644 --- a/lib/libc/stdlib/system.c +++ b/lib/libc/stdlib/system.c @@ -70,16 +70,20 @@ __libc_system(const char *command) (void)sigaddset(&newsigblock, SIGCHLD); (void)sigaddset(&newsigblock, SIGINT); (void)sigaddset(&newsigblock, SIGQUIT); - (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); + (void)__libc_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); switch(pid = vfork()) { + /* + * In the child, use unwrapped syscalls. libthr is in + * undefined state after vfork(). + */ case -1: /* error */ - (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + (void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); return (-1); case 0: /* child */ /* * Restore original signal dispositions and exec the command. */ - (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + (void)__sys_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL); _exit(127); } @@ -92,16 +96,16 @@ __libc_system(const char *command) memset(&ign, 0, sizeof(ign)); ign.sa_handler = SIG_IGN; (void)sigemptyset(&ign.sa_mask); - (void)_sigaction(SIGINT, &ign, &intact); - (void)_sigaction(SIGQUIT, &ign, &quitact); + (void)__libc_sigaction(SIGINT, &ign, &intact); + (void)__libc_sigaction(SIGQUIT, &ign, &quitact); savedpid = pid; do { pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0); } while (pid == -1 && errno == EINTR); - (void)_sigaction(SIGINT, &intact, NULL); - (void)_sigaction(SIGQUIT, &quitact, NULL); - (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); - return(pid == -1 ? -1 : pstat); + (void)__libc_sigaction(SIGINT, &intact, NULL); + (void)__libc_sigaction(SIGQUIT, &quitact, NULL); + (void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + return (pid == -1 ? -1 : pstat); } __weak_reference(__libc_system, __system); |