diff options
author | dyson <dyson@FreeBSD.org> | 1996-03-25 01:48:28 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1996-03-25 01:48:28 +0000 |
commit | 0b4693fada062b680c3f91d7e7d272ec10b0d3bb (patch) | |
tree | 08fea632d8c2a9f8343e4a7cab5c220c47fe617e /sys/kern/sys_pipe.c | |
parent | 55dd0b10275c30232b4a4c280728144869781080 (diff) | |
download | FreeBSD-src-0b4693fada062b680c3f91d7e7d272ec10b0d3bb.zip FreeBSD-src-0b4693fada062b680c3f91d7e7d272ec10b0d3bb.tar.gz |
Various pipe error return fixes, and a significant typeo fix. From
Bruce Evans (of course :-)).
Submitted by: bde
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r-- | sys/kern/sys_pipe.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 9bc3bf3..d4b168d 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -16,7 +16,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: sys_pipe.c,v 1.13 1996/02/22 03:33:52 dyson Exp $ + * $Id: sys_pipe.c,v 1.14 1996/03/17 04:52:10 dyson Exp $ */ #ifndef OLD_PIPE @@ -399,6 +399,7 @@ pipe_read(fp, uio, cred) * detect EOF condition */ if (rpipe->pipe_state & PIPE_EOF) { + /* XXX error = ? */ break; } /* @@ -479,7 +480,7 @@ pipe_read(fp, uio, cred) } } - if ((rpipe->pipe_buffer.size - rpipe->pipe_buffer.cnt) > PIPE_BUF) + if ((rpipe->pipe_buffer.size - rpipe->pipe_buffer.cnt) >= PIPE_BUF) pipeselwakeup(rpipe); return error; @@ -630,8 +631,12 @@ retry: wpipe->pipe_state |= PIPE_WANTW; error = tsleep(wpipe, PRIBIO|PCATCH, "pipdww", 0); - if (error || (wpipe->pipe_state & PIPE_EOF)) + if (error) goto error1; + if (wpipe->pipe_state & PIPE_EOF) { + error = EPIPE; + goto error1; + } } wpipe->pipe_map.cnt = 0; /* transfer not ready yet */ if (wpipe->pipe_buffer.cnt > 0) { @@ -643,9 +648,10 @@ retry: wpipe->pipe_state |= PIPE_WANTW; error = tsleep(wpipe, PRIBIO|PCATCH, "pipdwc", 0); - if (error || (wpipe->pipe_state & PIPE_EOF)) { - if (error == 0) - error = EPIPE; + if (error) + goto error1; + if (wpipe->pipe_state & PIPE_EOF) { + error = EPIPE; goto error1; } goto retry; @@ -666,8 +672,8 @@ retry: pipe_destroy_write_buffer(wpipe); pipeunlock(wpipe); pipeselwakeup(wpipe); - wakeup(wpipe); - return EPIPE; + error = EPIPE; + goto error1; } if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; @@ -854,7 +860,7 @@ pipewrite(wpipe, uio, nbio) (error == EPIPE)) error = 0; - if (error = 0) { + if (error == 0) { int s = splhigh(); wpipe->pipe_mtime = time; splx(s); |