summaryrefslogtreecommitdiff
path: root/lib/libc/gen/popen.c
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1997-06-22 23:18:56 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1997-06-22 23:18:56 +0000
commit5473dadfbaa0af98eace8927fc639ffe5975aeba (patch)
treee9d50fe89ace55bf2879ded4baa19e6d0e8c7a9f /lib/libc/gen/popen.c
parent021b21445ca5d52349dfec1dd12945aa402a21e7 (diff)
Fix a bogon in last change
Diffstat (limited to 'lib/libc/gen/popen.c')
-rw-r--r--lib/libc/gen/popen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index 414d61befdf..ccb2230ca51 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: popen.c,v 1.5 1997/06/22 20:01:48 tholo Exp $";
+static char rcsid[] = "$OpenBSD: popen.c,v 1.6 1997/06/22 23:18:55 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -93,12 +93,13 @@ popen(program, type)
close(fileno(cur->fp));
if (*type == 'r') {
+ int tpdes1 = pdes[1];
+
(void) close(pdes[0]);
/*
* We must NOT modify pdes, due to the
* semantics of vfork.
*/
- int tpdes1 = pdes[1];
if (tpdes1 != STDOUT_FILENO) {
(void)dup2(tpdes1, STDOUT_FILENO);
(void)close(tpdes1);