+2018-12-13 Bruno Haible <bruno@clisp.org>
+
+ select tests: Avoid test failure on Cygwin.
+ * tests/test-select.h (test_bad_fd): Use an fd < FD_SETSIZE.
+
2018-12-13 Bruno Haible <bruno@clisp.org>
localtime-buffer: Avoid endless recursion in localtime and gmtime.
/* 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. */
# 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)