aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index c93bf4c..863f8f2 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1472,11 +1472,6 @@ open (const char *unix_path, int flags, ...)
mode = va_arg (ap, mode_t);
va_end (ap);
- cygheap_fdnew fd;
-
- if (fd < 0)
- __leave; /* errno already set */
-
/* When O_PATH is specified in flags, flag bits other than O_CLOEXEC,
O_DIRECTORY, and O_NOFOLLOW are ignored. */
if (flags & O_PATH)
@@ -1577,6 +1572,12 @@ open (const char *unix_path, int flags, ...)
if ((flags & O_TMPFILE) && !fh->pc.isremote ())
try_to_bin (fh->pc, fh->get_handle (), DELETE,
FILE_OPEN_FOR_BACKUP_INTENT);
+
+ cygheap_fdnew fd;
+
+ if (fd < 0)
+ __leave; /* errno already set */
+
fd = fh;
if (fd <= 2)
set_std_handle (fd);
@@ -4534,8 +4535,9 @@ popen (const char *command, const char *in_type)
fcntl (stdchild, F_SETFD, stdchild_state | FD_CLOEXEC);
/* Start a shell process to run the given command without forking. */
- pid_t pid = ch_spawn.worker ("/bin/sh", argv, environ, _P_NOWAIT,
- __std[0], __std[1]);
+ child_info_spawn ch_spawn_local (_CH_NADA, false);
+ pid_t pid = ch_spawn_local.worker ("/bin/sh", argv, environ, _P_NOWAIT,
+ __std[0], __std[1]);
/* Reinstate the close-on-exec state */
fcntl (stdchild, F_SETFD, stdchild_state);