From: Thomas Veerman Date: Fri, 25 Jan 2013 17:42:36 +0000 (+0000) Subject: VFS: fix select again X-Git-Tag: v3.2.1~59 X-Git-Url: http://zhaoyanbai.com/repos/%7B%24global.css%7D?a=commitdiff_plain;h=06e2adbeaa0af08c93967937a6b430c2d96c1475;p=minix.git VFS: fix select again Change-Id: Ia5e26cdbfe38e3fb293dd57269a76b15c1fe236b --- diff --git a/servers/vfs/pipe.c b/servers/vfs/pipe.c index 0ad1c471b..4a61e7e75 100644 --- a/servers/vfs/pipe.c +++ b/servers/vfs/pipe.c @@ -190,10 +190,14 @@ int notouch /* check only */ int r = OK; /* Reads start at the beginning; writes append to pipes */ - if (rw_flag == READING) + if (notouch) /* In this case we don't actually care whether data transfer + * would succeed. See POSIX 1003.1-2008 */ pos = 0; - else + else if (rw_flag == READING) + pos = 0; + else { pos = vp->v_size; + } /* If reading, check for empty pipe. */ if (rw_flag == READING) { diff --git a/servers/vfs/select.c b/servers/vfs/select.c index d2c14e947..3fc08dac3 100644 --- a/servers/vfs/select.c +++ b/servers/vfs/select.c @@ -7,6 +7,7 @@ */ #include "fs.h" +#include #include #include #include @@ -452,7 +453,8 @@ static int select_request_pipe(struct filp *f, int *ops, int block) if ((*ops & (SEL_RD|SEL_ERR))) { /* Check if we can read 1 byte */ - err = pipe_check(f->filp_vno, READING, f->filp_flags, 1, 1 /* Check only */); + err = pipe_check(f->filp_vno, READING, f->filp_flags & ~O_NONBLOCK, 1, + 1 /* Check only */); if (err != SUSPEND) r |= SEL_RD; @@ -468,7 +470,8 @@ static int select_request_pipe(struct filp *f, int *ops, int block) if ((*ops & (SEL_WR|SEL_ERR))) { /* Check if we can write 1 byte */ - err = pipe_check(f->filp_vno, WRITING, f->filp_flags, 1, 1 /* Check only */); + err = pipe_check(f->filp_vno, WRITING, f->filp_flags & ~O_NONBLOCK, 1, + 1 /* Check only */); if (err != SUSPEND) r |= SEL_WR;