]> Savannah Git Hosting - gnulib.git/commitdiff
unistd-safer: Implement pipe_safer on native Windows.
authorBruno Haible <bruno@clisp.org>
Fri, 25 Dec 2020 01:16:18 +0000 (02:16 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 25 Dec 2020 01:18:50 +0000 (02:18 +0100)
* lib/pipe-safer.c (pipe_safer): Don't test HAVE_PIPE.
* modules/unistd-safer (Depends-on): Add pipe-posix.

ChangeLog
lib/pipe-safer.c
modules/unistd-safer

index afc5829ebb372eccdcae3d6bbe83758f7b138cc7..3d8478aebd8044512f92f7581268c9809f0ce614 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-24  Bruno Haible  <bruno@clisp.org>
+
+       unistd-safer: Implement pipe_safer on native Windows.
+       * lib/pipe-safer.c (pipe_safer): Don't test HAVE_PIPE.
+       * modules/unistd-safer (Depends-on): Add pipe-posix.
+
 2020-12-24  Bruno Haible  <bruno@clisp.org>
 
        execute: Use posix_spawn by default on native Windows.
index 5a597c527015d111e1c35e55e01359a6b0037f15..a90ed81b2603c6e9ffd40119df2d051fb8dbad8a 100644 (file)
@@ -30,7 +30,6 @@
 int
 pipe_safer (int fd[2])
 {
-#if HAVE_PIPE
   if (pipe (fd) == 0)
     {
       int i;
@@ -39,18 +38,15 @@ pipe_safer (int fd[2])
           fd[i] = fd_safer (fd[i]);
           if (fd[i] < 0)
             {
-              int e = errno;
+              int saved_errno = errno;
               close (fd[1 - i]);
-              errno = e;
+              errno = saved_errno;
               return -1;
             }
         }
 
       return 0;
     }
-#else
-  errno = ENOSYS;
-#endif
 
   return -1;
 }
index 2d195ecd12c2e0c8e99b41afd48dbac8f3c298b2..d131b9c7a8f196563dc49f4d2965b71dcb96b0e4 100644 (file)
@@ -12,6 +12,7 @@ m4/unistd-safer.m4
 Depends-on:
 fcntl
 unistd
+pipe-posix
 
 configure.ac:
 gl_UNISTD_SAFER