summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/system.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib/system.c')
-rw-r--r--lib/libc/stdlib/system.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c
index c7e68ba..3b16454 100644
--- a/lib/libc/stdlib/system.c
+++ b/lib/libc/stdlib/system.c
@@ -37,6 +37,7 @@
static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#include "namespace.h"
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
@@ -45,6 +46,8 @@ static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93";
#include <unistd.h>
#include <paths.h>
#include <errno.h>
+#include "un-namespace.h"
+#include "libc_private.h"
int
__system(command)
@@ -65,11 +68,11 @@ __system(command)
ign.sa_handler = SIG_IGN;
(void)sigemptyset(&ign.sa_mask);
ign.sa_flags = 0;
- (void)sigaction(SIGINT, &ign, &intact);
- (void)sigaction(SIGQUIT, &ign, &quitact);
+ (void)_sigaction(SIGINT, &ign, &intact);
+ (void)_sigaction(SIGQUIT, &ign, &quitact);
(void)sigemptyset(&newsigblock);
(void)sigaddset(&newsigblock, SIGCHLD);
- (void)sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
+ (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
switch(pid = fork()) {
case -1: /* error */
break;
@@ -77,9 +80,9 @@ __system(command)
/*
* Restore original signal dispositions and exec the command.
*/
- (void)sigaction(SIGINT, &intact, NULL);
- (void)sigaction(SIGQUIT, &quitact, NULL);
- (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ (void)_sigaction(SIGINT, &intact, NULL);
+ (void)_sigaction(SIGQUIT, &quitact, NULL);
+ (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
_exit(127);
default: /* parent */
@@ -88,12 +91,11 @@ __system(command)
} while (pid == -1 && errno == EINTR);
break;
}
- (void)sigaction(SIGINT, &intact, NULL);
- (void)sigaction(SIGQUIT, &quitact, NULL);
- (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ (void)_sigaction(SIGINT, &intact, NULL);
+ (void)_sigaction(SIGQUIT, &quitact, NULL);
+ (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
return(pid == -1 ? -1 : pstat);
}
-#ifndef _THREAD_SAFE
__weak_reference(__system, system);
-#endif
+__weak_reference(__system, _system);
OpenPOWER on IntegriCloud