diff options
author | bapt <bapt@FreeBSD.org> | 2015-10-13 19:44:36 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-10-13 19:44:36 +0000 |
commit | c8d6d4a78596005d50c30c7ab4f623a601ef0b39 (patch) | |
tree | e5218cae2f48913719be46210d8d92085cb2511f /lib/libc/stdlib/system.c | |
parent | 2a77c3b71d27973d4ffac086902715be69266202 (diff) | |
parent | 384c892651c52e57063356328dfcd28914bc4b15 (diff) | |
download | FreeBSD-src-c8d6d4a78596005d50c30c7ab4f623a601ef0b39.zip FreeBSD-src-c8d6d4a78596005d50c30c7ab4f623a601ef0b39.tar.gz |
Merge from head
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); |