diff options
author | dyson <dyson@FreeBSD.org> | 1996-01-31 02:05:12 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1996-01-31 02:05:12 +0000 |
commit | 78108c6c2fff0fe74a09fa9d0322852075446a13 (patch) | |
tree | 6be25ebe4e5c5f5f3742fc4272ba499afb7637e7 | |
parent | e728cbefd87b54a317340ab17344662f36c056e5 (diff) | |
download | FreeBSD-src-78108c6c2fff0fe74a09fa9d0322852075446a13.zip FreeBSD-src-78108c6c2fff0fe74a09fa9d0322852075446a13.tar.gz |
Fix some problems with return codes on the new pipe stuff. Bruce Evans
found the problems, and this commit will fix the "first batch" :-).
-rw-r--r-- | sys/kern/sys_pipe.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 1ebbac3..653b495 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -18,7 +18,7 @@ * 5. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: sys_pipe.c,v 1.1 1996/01/28 23:38:26 dyson Exp $ + * $Id: sys_pipe.c,v 1.2 1996/01/29 02:57:33 dyson Exp $ */ #ifndef OLD_PIPE @@ -265,8 +265,12 @@ pipe_read(fp, uio, cred) rpipe->pipe_state &= ~PIPE_WANTW; wakeup(rpipe); } - if ((nread > 0) || (rpipe->pipe_state & PIPE_NBIO)) + if (nread > 0) break; + if (rpipe->pipe_state & PIPE_NBIO) { + error = EAGAIN; + break; + } if (rpipe->pipe_peer == NULL) break; @@ -342,7 +346,7 @@ pipe_write(fp, uio, cred) */ if (wpipe == NULL || (wpipe->pipe_state & PIPE_EOF)) { psignal(curproc, SIGPIPE); - return 0; + return EPIPE; } ++wpipe->pipe_busy; @@ -393,7 +397,7 @@ pipe_write(fp, uio, cred) */ if (wpipe->pipe_state & PIPE_EOF) { psignal(curproc, SIGPIPE); - break; + error = EPIPE; } } } |