test-pipe: fix mingw build
authorEric Blake <ebb9@byu.net>
Sat, 18 Jul 2009 15:10:05 +0000 (09:10 -0600)
committerEric Blake <ebb9@byu.net>
Sat, 18 Jul 2009 15:47:09 +0000 (09:47 -0600)
* tests/test-pipe.c (main): Avoid fcntl on mingw.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
tests/test-pipe.c

index dbafa7d..94adb9f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-18  Eric Blake  <ebb9@byu.net>
+
+       test-pipe: fix mingw build
+       * tests/test-pipe.c (main): Avoid fcntl on mingw.
+
 2009-07-18  Bruno Haible  <bruno@clisp.org>
 
        * modules/pipe-tests (Makefile.am): Fix typo.
index 3018186..b5f70d0 100644 (file)
@@ -131,7 +131,13 @@ main (int argc, const char *argv[])
         buffer[0]++;
         ASSERT (write (STDOUT_FILENO, buffer, 1) == 1);
         errno = 0;
+#ifdef F_GETFL
+        /* Try to keep stderr open for better diagnostics.  */
         i = fcntl (STDERR_FILENO, F_GETFL);
+#else
+        /* But allow compilation on mingw.  */
+        i = close (STDERR_FILENO);
+#endif
         if (test == 8)
           ASSERT (0 <= i);
         else