fdopen: Allow implementations that don't reject invalid fd arguments.
authorBruno Haible <bruno@clisp.org>
Wed, 20 Jun 2012 20:51:06 +0000 (22:51 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 20 Jun 2012 20:51:06 +0000 (22:51 +0200)
* m4/fdopen.m4 (gl_FUNC_FDOPEN): Let the test pass if fdopen(-1,...)
succeeds.
Reported by Rich Felker <dalias@aerifal.cx>.

ChangeLog
m4/fdopen.m4

index a363d565213d4049db108ecc98eb37b01c1288a9..34bcd6db54fe2b8d17b1b1684e4bdd5f14c8addb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-06-20  Bruno Haible  <bruno@clisp.org>
+
+       fdopen: Allow implementations that don't reject invalid fd arguments.
+       * m4/fdopen.m4 (gl_FUNC_FDOPEN): Let the test pass if fdopen(-1,...)
+       succeeds.
+       Reported by Rich Felker <dalias@aerifal.cx>.
+
 2012-06-20  Simon Josefsson  <simon@josefsson.org>
 
        * modules/parse-duration-tests (test_parse_duration_LDADD): Don't
index 9ca9d2aca62d42e581d3b28618da4ff883d8af8d..14f15540c7b5e11d8bcd5e47ebd54a52d10b3511 100644 (file)
@@ -1,4 +1,4 @@
-# fdopen.m4 serial 2
+# fdopen.m4 serial 3
 dnl Copyright (C) 2011-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,10 +25,8 @@ main (void)
   FILE *fp;
   errno = 0;
   fp = fdopen (-1, "r");
-  if (fp != NULL)
+  if (fp == NULL && errno == 0)
     return 1;
-  if (errno == 0)
-    return 2;
   return 0;
 }]])],
           [gl_cv_func_fdopen_works=yes],