patch-2.1.108 linux/fs/select.c
Next file: linux/fs/sysv/CHANGES
Previous file: linux/fs/proc/array.c
Back to the patch index
Back to the overall index
- Lines: 39
- Date:
Thu Jun 25 10:39:32 1998
- Orig file:
v2.1.107/linux/fs/select.c
- Orig date:
Thu Mar 26 15:57:05 1998
diff -u --recursive --new-file v2.1.107/linux/fs/select.c linux/fs/select.c
@@ -297,21 +297,25 @@
current->state = TASK_INTERRUPTIBLE;
for (fdpnt = fds, j = 0; j < nfds; j++, fdpnt++) {
+ int fd;
unsigned int mask;
- struct file * file;
- mask = POLLNVAL;
- /* poll_wait increments f_count if needed */
- file = fcheck(fdpnt->fd);
- if (file != NULL) {
- mask = DEFAULT_POLLMASK;
- if (file->f_op && file->f_op->poll)
- mask = file->f_op->poll(file, wait);
- mask &= fdpnt->events | POLLERR | POLLHUP;
- }
- if (mask) {
- wait = NULL;
- count++;
+ mask = 0;
+ fd = fdpnt->fd;
+ if (fd >= 0) {
+ /* poll_wait increments f_count if needed */
+ struct file * file = fcheck(fd);
+ mask = POLLNVAL;
+ if (file != NULL) {
+ mask = DEFAULT_POLLMASK;
+ if (file->f_op && file->f_op->poll)
+ mask = file->f_op->poll(file, wait);
+ mask &= fdpnt->events | POLLERR | POLLHUP;
+ }
+ if (mask) {
+ wait = NULL;
+ count++;
+ }
}
fdpnt->revents = mask;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov