diff options
Diffstat (limited to 'lib/libc/gen/popen.c')
-rw-r--r-- | lib/libc/gen/popen.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c index 7939b8f..2070f83 100644 --- a/lib/libc/gen/popen.c +++ b/lib/libc/gen/popen.c @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 5/3/95"; #endif /* LIBC_SCCS and not lint */ +#include "namespace.h" #include <sys/param.h> #include <sys/wait.h> @@ -50,6 +51,7 @@ static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 5/3/95"; #include <stdlib.h> #include <string.h> #include <paths.h> +#include "un-namespace.h" extern char **environ; @@ -70,7 +72,7 @@ popen(command, type) struct pid *p; /* - * Lite2 introduced two-way popen() pipes using socketpair(). + * Lite2 introduced two-way popen() pipes using _socketpair(). * FreeBSD's pipe() is bidirectional, so we use that. */ if (strchr(type, '+')) { @@ -105,7 +107,7 @@ popen(command, type) case 0: /* Child. */ if (*type == 'r') { /* - * The dup2() to STDIN_FILENO is repeated to avoid + * The _dup2() to STDIN_FILENO is repeated to avoid * writing to pdes[1], which might corrupt the * parent's copy. This isn't good enough in * general, since the _exit() is no return, so @@ -114,15 +116,15 @@ popen(command, type) */ (void)_close(pdes[0]); if (pdes[1] != STDOUT_FILENO) { - (void)dup2(pdes[1], STDOUT_FILENO); + (void)_dup2(pdes[1], STDOUT_FILENO); (void)_close(pdes[1]); if (twoway) - (void)dup2(STDOUT_FILENO, STDIN_FILENO); + (void)_dup2(STDOUT_FILENO, STDIN_FILENO); } else if (twoway && (pdes[1] != STDIN_FILENO)) - (void)dup2(pdes[1], STDIN_FILENO); + (void)_dup2(pdes[1], STDIN_FILENO); } else { if (pdes[0] != STDIN_FILENO) { - (void)dup2(pdes[0], STDIN_FILENO); + (void)_dup2(pdes[0], STDIN_FILENO); (void)_close(pdes[0]); } (void)_close(pdes[1]); @@ -130,7 +132,7 @@ popen(command, type) for (p = pidlist; p; p = p->next) { (void)_close(fileno(p->fp)); } - execve(_PATH_BSHELL, argv, environ); + _execve(_PATH_BSHELL, argv, environ); _exit(127); /* NOTREACHED */ } |