]> Savannah Git Hosting - gnulib.git/commitdiff
accept4-tests: fix to avoid non portable flags
authorPino Toscano <ptoscano@redhat.com>
Mon, 12 Oct 2015 11:27:10 +0000 (12:27 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 12 Oct 2015 11:32:53 +0000 (12:32 +0100)
* tests/test-accept4.c (main): Pass only SOCK_* flags to accept4(),
as they are the only documented ones, and passing others may trigger
EINVAL (seen on FreeBSD 10.1-RELEASE).
* doc/glibc-functions/accept4.texi: Mention that we don't provide
the SOCK_CLOEXEC or SOCK_NONBLOCK defines.

ChangeLog
doc/glibc-functions/accept4.texi
tests/test-accept4.c

index 02d8bf822f7be4fd8e5255ae947c7ae39a14a84e..d0c3557c2fcaa86ffe028795bee2fd9208634766 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-10-12  Pino Toscano  <ptoscano@redhat.com>
+
+       accept4-tests: fix to avoid non portable flags
+       * tests/test-accept4.c (main): Pass only SOCK_* flags to accept4(),
+       as they are the only documented ones, and passing others may trigger
+       EINVAL (seen on FreeBSD 10.1-RELEASE).
+       * doc/glibc-functions/accept4.texi: Mention that we don't provide
+       the SOCK_CLOEXEC or SOCK_NONBLOCK defines.
+
 2015-10-06  Pavel Raiskup  <praiskup@redhat.com>
 
        gnulib-tool: fix tests of 'extensions' module
index 20386e94d880092f9d31513dc9ee8f157db13e54..b4114db187856b1ad2c6d04535dd4ebc20141e1f 100644 (file)
@@ -16,4 +16,7 @@ programs that spawn child processes.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+SOCK_CLOEXEC and SOCK_NONBLOCK may not be defined
+as they're also significant to the socket() function.
 @end itemize
index b24af0bed098a2a83e008b8d3746e4c76ea38a0e..e900b48fbce65967f0f4efdedeb2f388edf46355 100644 (file)
@@ -31,6 +31,10 @@ SIGNATURE_CHECK (accept4, int, (int, struct sockaddr *, socklen_t *, int));
 
 #include "macros.h"
 
+#ifndef SOCK_CLOEXEC
+# define SOCK_CLOEXEC 0
+#endif
+
 int
 main (void)
 {
@@ -43,7 +47,7 @@ main (void)
 
     errno = 0;
     ASSERT (accept4 (-1, (struct sockaddr *) &addr, &addrlen,
-                     O_CLOEXEC | O_BINARY)
+                     SOCK_CLOEXEC)
             == -1);
     ASSERT (errno == EBADF);
   }
@@ -54,7 +58,7 @@ main (void)
     close (99);
     errno = 0;
     ASSERT (accept4 (99, (struct sockaddr *) &addr, &addrlen,
-                     O_CLOEXEC | O_BINARY)
+                     SOCK_CLOEXEC)
             == -1);
     ASSERT (errno == EBADF);
   }