From: Thomas Veerman Date: Tue, 14 Jul 2009 09:39:05 +0000 (+0000) Subject: Fixed a minor select bug: X-Git-Tag: v3.1.5~213 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=ce916bcb9179de68d1869b6f3484fb664ca70f67;p=minix.git 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. --- diff --git a/servers/vfs/pipe.c b/servers/vfs/pipe.c index f80f02832..03f9e45f8 100644 --- a/servers/vfs/pipe.c +++ b/servers/vfs/pipe.c @@ -574,6 +574,12 @@ PUBLIC int select_request_pipe(struct filp *f, int *ops, int block) r |= SEL_RD; if (err < 0 && err != SUSPEND) 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 ((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; if (err < 0 && err != SUSPEND) 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. */