* lib/poll.c: Do not include intprops.h.
(poll): Compare NFD to INT_MAX, not to TYPE_MAXIMUM (nfds_t) / 2.
* modules/poll (Depends-on): Remove intprops.
2017-04-22 Paul Eggert <eggert@cs.ucla.edu>
+ poll: improve fast check for out-of-range NFD
+ * lib/poll.c: Do not include intprops.h.
+ (poll): Compare NFD to INT_MAX, not to TYPE_MAXIMUM (nfds_t) / 2.
+ * modules/poll (Depends-on): Remove intprops.
+
ftoastr: cite a newer paper
* lib/ftoastr.c (FTOASTR): In comment, cite Andrysco et al. 2016
instead of Loitsch 2010.
#include <time.h>
#include "assure.h"
-#include "intprops.h"
#ifndef INFTIM
# define INFTIM (-1)
int maxfd, rc;
nfds_t i;
- if (nfd > TYPE_MAXIMUM (nfds_t) / 2)
+ if (nfd > INT_MAX)
{
errno = EINVAL;
return -1;
}
- /* Don't check directly for NFD too large. Any practical use of a
- too-large NFD is caught by one of the other checks below, and
+ /* Don't check directly for NFD greater than OPEN_MAX. Any practical use
+ of a too-large NFD is caught by one of the other checks below, and
checking directly for getdtablesize is too much of a portability
and/or performance and/or correctness hassle. */
int rc = 0;
nfds_t i;
- if (nfd > TYPE_MAXIMUM (nfds_t) / 2 || timeout < -1)
+ if (nfd > INT_MAX || timeout < -1)
{
errno = EINVAL;
return -1;
poll-h
alloca [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
assure [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
-intprops [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
select [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
sockets [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
sys_select [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]