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 a363d56..34bcd6d 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 9ca9d2a..14f1554 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],