utimens: cache whether utimensat syscall works
[pspp] / lib / pipe.c
index c63321c257e02a446c7168c406856f08b5eb31d7..d17c9bf6c6c9b561dec1e6492890e6ed06d39ef1 100644 (file)
@@ -35,7 +35,7 @@
 
 #define _(str) gettext (str)
 
-#if defined _MSC_VER || defined __MINGW32__
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
 /* Native Woe32 API.  */
 # include <process.h>
@@ -112,7 +112,7 @@ create_pipe (const char *progname,
             bool slave_process, bool exit_on_error,
             int fd[2])
 {
-#if defined _MSC_VER || defined __MINGW32__
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
   /* Native Woe32 API.
      This uses _pipe(), dup2(), and spawnv().  It could also be implemented
@@ -133,12 +133,12 @@ create_pipe (const char *progname,
   prog_argv = prepare_spawn (prog_argv);
 
   if (pipe_stdout)
-    if (_pipe (ifd, 4096, O_BINARY | O_NOINHERIT) < 0
+    if (pipe2 (ifd, O_BINARY | O_NOINHERIT) < 0
        || (ifd[0] = fd_safer_noinherit (ifd[0])) < 0
        || (ifd[1] = fd_safer_noinherit (ifd[1])) < 0)
       error (EXIT_FAILURE, errno, _("cannot create pipe"));
   if (pipe_stdin)
-    if (_pipe (ofd, 4096, O_BINARY | O_NOINHERIT) < 0
+    if (pipe2 (ofd, O_BINARY | O_NOINHERIT) < 0
        || (ofd[0] = fd_safer_noinherit (ofd[0])) < 0
        || (ofd[1] = fd_safer_noinherit (ofd[1])) < 0)
       error (EXIT_FAILURE, errno, _("cannot create pipe"));
@@ -185,9 +185,7 @@ create_pipe (const char *progname,
                      && close (stdoutfd) >= 0)))))
     /* The child process doesn't inherit ifd[0], ifd[1], ofd[0], ofd[1],
        but it inherits all open()ed or dup2()ed file handles (which is what
-       we want in the case of STD*_FILENO) and also orig_stdin,
-       orig_stdout, orig_stderr (which is not explicitly wanted but
-       harmless).  */
+       we want in the case of STD*_FILENO).  */
     /* Use spawnvpe and pass the environment explicitly.  This is needed if
        the program has modified the environment using putenv() or [un]setenv().
        On Windows, programs have two environments, one in the "environment