diff options
author | bde <bde@FreeBSD.org> | 1997-04-22 09:44:06 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-04-22 09:44:06 +0000 |
commit | 5e1197d908cdd207923561eabb3c956e064c1484 (patch) | |
tree | 625a1c7a2fe49c6fa566369998eccef8f9d5255b | |
parent | ae3a563c6ee04fa1b4d008183af8eb1e1f23f05e (diff) | |
download | FreeBSD-src-5e1197d908cdd207923561eabb3c956e064c1484.zip FreeBSD-src-5e1197d908cdd207923561eabb3c956e064c1484.tar.gz |
FIxed the cleanup. I forgot to leave stdin alone in the usual (!twoway)
case.
-rw-r--r-- | lib/libc/gen/popen.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c index 826ec93..8cb7950 100644 --- a/lib/libc/gen/popen.c +++ b/lib/libc/gen/popen.c @@ -105,7 +105,8 @@ popen(command, type) if (pdes[1] != STDOUT_FILENO) { (void)dup2(pdes[1], STDOUT_FILENO); (void)close(pdes[1]); - (void)dup2(STDOUT_FILENO, STDIN_FILENO); + if (twoway) + (void)dup2(STDOUT_FILENO, STDIN_FILENO); } else if (twoway && (pdes[1] != STDIN_FILENO)) (void)dup2(pdes[1], STDIN_FILENO); } else { |