From b8a3d3dcf20850b7404a76d1e1b9dea7b4ba5080 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 20 Jun 2012 22:51:06 +0200 Subject: [PATCH] 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 . --- ChangeLog | 7 +++++++ m4/fdopen.m4 | 6 ++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a363d5652..34bcd6db5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-06-20 Bruno Haible + + 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 . + 2012-06-20 Simon Josefsson * modules/parse-duration-tests (test_parse_duration_LDADD): Don't diff --git a/m4/fdopen.m4 b/m4/fdopen.m4 index 9ca9d2aca..14f15540c 100644 --- a/m4/fdopen.m4 +++ b/m4/fdopen.m4 @@ -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], -- 2.11.0