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;