From ce916bcb9179de68d1869b6f3484fb664ca70f67 Mon Sep 17 00:00:00 2001 From: Thomas Veerman Date: Tue, 14 Jul 2009 09:39:05 +0000 Subject: [PATCH] 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. --- servers/vfs/pipe.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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. */ -- 2.44.0