summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/popen.c
diff options
context:
space:
mode:
authortholo <tholo@openbsd.org>1997-06-22 23:18:55 +0000
committertholo <tholo@openbsd.org>1997-06-22 23:18:55 +0000
commit0caf00bf3273c2770c2bb74973e6b896ab3b7386 (patch)
tree90a7c7beddc4f4f449cf31aa34a21fc922a49a2d /lib/libc/gen/popen.c
parentConvert the find(1) examples to mandoc. (diff)
downloadwireguard-openbsd-0caf00bf3273c2770c2bb74973e6b896ab3b7386.tar.xz
wireguard-openbsd-0caf00bf3273c2770c2bb74973e6b896ab3b7386.zip
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);