diff options
author | Clint Adams <clint@debian.org> | 2018-12-22 09:23:19 -0500 |
---|---|---|
committer | Clint Adams <clint@debian.org> | 2018-12-22 09:23:19 -0500 |
commit | 637a2e292881341dde845545517b0ed3d3ccfc94 (patch) | |
tree | c0d05d9f8978af415c5cea9ec39fc85b6bfb6cec /gnulib-tests/test-select.h | |
parent | 117dcd10d7e04d0dda7668518b8d085027f4d705 (diff) |
New upstream version 4.7
Diffstat (limited to 'gnulib-tests/test-select.h')
-rw-r--r-- | gnulib-tests/test-select.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gnulib-tests/test-select.h b/gnulib-tests/test-select.h index d751e42..b0f17f3 100644 --- a/gnulib-tests/test-select.h +++ b/gnulib-tests/test-select.h @@ -18,6 +18,7 @@ #include <stdio.h> #include <string.h> +#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> @@ -29,7 +30,7 @@ #include "macros.h" -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ # define WINDOWS_NATIVE #endif @@ -37,10 +38,6 @@ # include <sys/wait.h> #endif -#ifndef SO_REUSEPORT -# define SO_REUSEPORT SO_REUSEADDR -#endif - #define TEST_PORT 12345 @@ -245,9 +242,11 @@ test_bad_nfd (select_fn my_select) /* Can't test FD_SETSIZE + 1 for EINVAL, since some systems allow dynamically larger set size by redefining FD_SETSIZE anywhere up to the actual maximum fd. */ - /* if (do_select_bad_nfd_nowait (FD_SETSIZE + 1, my_select) != -1 */ - /* || errno != EINVAL) */ - /* failed ("invalid errno after bogus nfds"); */ +#if 0 + if (do_select_bad_nfd_nowait (FD_SETSIZE + 1, my_select) != -1 + || errno != EINVAL) + failed ("invalid errno after bogus nfds"); +#endif } /* Test select(2) on invalid file descriptors. */ @@ -297,6 +296,11 @@ test_bad_fd (select_fn my_select) # else fd = 99; # endif + /* Even on the best POSIX compliant platforms, values of fd >= FD_SETSIZE + require an nfds argument that is > FD_SETSIZE and thus may lead to EINVAL, + not EBADF. */ + if (fd >= FD_SETSIZE) + fd = FD_SETSIZE - 1; close (fd); if (do_select_bad_fd_nowait (fd, SEL_IN, my_select) == 0 || errno != EBADF) |