]> Savannah Git Hosting - gnulib.git/commitdiff
posix_spawn_file_actions_addclose: Relax configure test.
authorBruno Haible <bruno@clisp.org>
Mon, 25 Jan 2021 08:59:20 +0000 (09:59 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 25 Jan 2021 09:00:19 +0000 (10:00 +0100)
* m4/posix_spawn.m4 (gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE): Test a
negative file descriptor, not an out-of-range file descriptor.
* tests/test-posix_spawn_file_actions_addclose.c (main): Add comment.
* doc/posix-functions/posix_spawn_file_actions_addclose.texi: Update.

ChangeLog
doc/posix-functions/posix_spawn_file_actions_addclose.texi
m4/posix_spawn.m4
tests/test-posix_spawn_file_actions_addclose.c

index 22c66ea3f6f47d7ec04740bf13a6e7853862b459..2f40b72af477b52d7f348404d795bd1026c2c2f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-01-25  Bruno Haible  <bruno@clisp.org>
+
+       posix_spawn_file_actions_addclose: Relax configure test.
+       * m4/posix_spawn.m4 (gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE): Test a
+       negative file descriptor, not an out-of-range file descriptor.
+       * tests/test-posix_spawn_file_actions_addclose.c (main): Add comment.
+       * doc/posix-functions/posix_spawn_file_actions_addclose.texi: Update.
+
 2021-01-25  Simon Josefsson  <simon@josefsson.org>
 
        getaddrinfo: Doc fix.
index 6a1ba1b1e75f4852b9fecb91541f135c3874aea6..db5bcfd2204c316864525c5deb9e7538a32ac644 100644 (file)
@@ -12,8 +12,8 @@ Portability problems fixed by Gnulib:
 This function is missing on some platforms:
 FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 14, Android 8.1.
 @item
-This function does not reject a too large file descriptor on some platforms:
-musl libc, Solaris 11.4.
+This function does not reject a negative file descriptor on some platforms:
+musl libc.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 787336d7e71fb61cc819863f121db285e16eeab8..da8713038c046287b6313d3c83c6ab017fe8d75b 100644 (file)
@@ -1,4 +1,4 @@
-# posix_spawn.m4 serial 19
+# posix_spawn.m4 serial 20
 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -552,8 +552,8 @@ AC_DEFUN([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE],
   if test $REPLACE_POSIX_SPAWN = 1; then
     REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=1
   else
-    dnl On musl libc and Solaris 11.0, posix_spawn_file_actions_addclose
-    dnl succeeds even if the fd argument is out of range.
+    dnl On musl libc, posix_spawn_file_actions_addclose succeeds even if the fd
+    dnl argument is negative.
     AC_CACHE_CHECK([whether posix_spawn_file_actions_addclose works],
       [gl_cv_func_posix_spawn_file_actions_addclose_works],
       [AC_RUN_IFELSE(
@@ -564,7 +564,7 @@ int main ()
   posix_spawn_file_actions_t actions;
   if (posix_spawn_file_actions_init (&actions) != 0)
     return 1;
-  if (posix_spawn_file_actions_addclose (&actions, 10000000) == 0)
+  if (posix_spawn_file_actions_addclose (&actions, -5) == 0)
     return 2;
   return 0;
 }]])],
index 3aca3338de8f67b32f790c862cbacb209e715540..2c910ea572115b64dca0c45428171cfc01059334 100644 (file)
@@ -54,6 +54,8 @@ main (void)
     errno = 0;
     ASSERT (posix_spawn_file_actions_addclose (&actions, -1) == EBADF);
   }
+  /* This behaviour is not mandated by POSIX, but happens to pass on all
+     platforms.  */
   {
     int bad_fd = big_fd ();
     errno = 0;