summaryrefslogtreecommitdiff
path: root/tests/test-accept4.c
diff options
context:
space:
mode:
authorPino Toscano <ptoscano@redhat.com>2015-10-12 12:27:10 +0100
committerPádraig Brady <P@draigBrady.com>2015-10-12 12:32:53 +0100
commitf982bc8df29c417d1c5c4a46866a1bc41ded65f6 (patch)
tree2bacd4795a916d877629b55381832b2ed9635137 /tests/test-accept4.c
parent2aaf4325268c6181bcf0b8f3fb71d25927178153 (diff)
downloadgnulib-f982bc8df29c417d1c5c4a46866a1bc41ded65f6.tar.gz
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.
Diffstat (limited to 'tests/test-accept4.c')
-rw-r--r--tests/test-accept4.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test-accept4.c b/tests/test-accept4.c
index b24af0bed0..e900b48fbc 100644
--- a/tests/test-accept4.c
+++ b/tests/test-accept4.c
@@ -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);
}