select: reject invalid file descriptors
authorEric Blake <eblake@redhat.com>
Tue, 2 Oct 2012 21:29:13 +0000 (15:29 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 3 Oct 2012 01:39:20 +0000 (19:39 -0600)
commit9500a55f083bb8e55ee938e4532ae6baea702e6b
tree763986d43ad9152c39da431080287959e3c8d5e9
parent2f58d08d66740bfe7fe5c581027965da04afecd7
select: reject invalid file descriptors

POSIX requires invalid file descriptors to be detected rather than
silently ignored.  FreeBSD 8.2 detects if fd 0 has been closed
and appears in a set while fd 1 is still open, but mistakenly
optimizes and refuses to check any fds in the set beyond the
maximum open fd.

* m4/select.m4 (gl_FUNC_SELECT): Probe for FreeBSD bug.
* lib/select.c (rpl_select) [!win32]: Work around it.
* modules/select (Depends-on): Add dup2.
* doc/posix-functions/select.texi (select): Document this.
ChangeLog
doc/posix-functions/select.texi
lib/select.c
m4/select.m4
modules/select