summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 7801ea2b3..1bbf570e3 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -3517,14 +3517,13 @@ popen (const char *command, const char *in_type)
fcntl64 (stdwhat, F_SETFD, state);
}
- if (pid < 0)
- goto err;
- close (other_fd);
-
- fhandler_pipe *fh = (fhandler_pipe *) cygheap->fdtab[fd];
- fh->set_popen_pid (pid);
-
- return fp;
+ if (pid >= 0)
+ {
+ close (other_fd);
+ fhandler_pipe *fh = (fhandler_pipe *) cygheap->fdtab[fd];
+ fh->set_popen_pid (pid);
+ return fp;
+ }
err:
int save_errno = get_errno ();