Fixed a minor select bug:

- When one does a select on a file descriptor that is meaningless for that particular file type, select shall indicate that the file descriptor is ready for that particular operation and that the file descriptor has no exceptional condition pending.
This commit is contained in:
Thomas Veerman 2009-07-14 09:39:05 +00:00
parent b21beea985
commit ce916bcb91

View file

@ -574,6 +574,12 @@ PUBLIC int select_request_pipe(struct filp *f, int *ops, int block)
r |= SEL_RD; r |= SEL_RD;
if (err < 0 && err != SUSPEND) if (err < 0 && err != SUSPEND)
r |= SEL_ERR; r |= SEL_ERR;
if(err == SUSPEND && f->filp_mode & W_BIT) {
/* A "meaningless" read select, therefore ready
for reading and no error set. */
r |= SEL_RD;
r &= ~SEL_ERR;
}
} }
if ((*ops & (SEL_WR|SEL_ERR))) { if ((*ops & (SEL_WR|SEL_ERR))) {
if ((err = Xpipe_check(f->filp_vno, WRITING, 0, if ((err = Xpipe_check(f->filp_vno, WRITING, 0,
@ -581,6 +587,12 @@ PUBLIC int select_request_pipe(struct filp *f, int *ops, int block)
r |= SEL_WR; r |= SEL_WR;
if (err < 0 && err != SUSPEND) if (err < 0 && err != SUSPEND)
r |= SEL_ERR; r |= SEL_ERR;
if(err == SUSPEND && f->filp_mode & R_BIT) {
/* A "meaningless" write select, therefore ready
for reading and no error set. */
r |= SEL_WR;
r &= ~SEL_ERR;
}
} }
/* Some options we collected might not be requested. */ /* Some options we collected might not be requested. */