Yup, looks like a bug. Even SVR4 specifies ignoring negative fds.
Here's a candidate fix, which I have not tested except that it compiles.
This patch is against kernel 2.1.105ac5 (sorry, it's what I had handy).
-=] Ford [=-
"That's high quality Velcro. Can you (In Real Life: Mike Ditto)
get this spot out? More Tang, Mom." ford@omnicron.com
-- Jerry Steiner http://www.omnicron.com/~ford/ford.html
--- fs/ORIGselect.c Mon Mar 23 10:13:52 1998
+++ fs/select.c Wed Jun 24 01:39:24 1998
@@ -300,15 +300,16 @@
unsigned int mask;
struct file * file;
- mask = POLLNVAL;
+ if (fdpnt->fd < 0)
+ mask = 0;
/* poll_wait increments f_count if needed */
- file = fcheck(fdpnt->fd);
- if (file != NULL) {
+ else if ((file = fcheck(fdpnt->fd)) != NULL) {
mask = DEFAULT_POLLMASK;
if (file->f_op && file->f_op->poll)
mask = file->f_op->poll(file, wait);
mask &= fdpnt->events | POLLERR | POLLHUP;
- }
+ } else
+ mask = POLLNVAL;
if (mask) {
wait = NULL;
count++;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu