From db3510e6f8c12e36388bbc5137da2dd2328a720f Mon Sep 17 00:00:00 2001 From: jdolecek Date: Tue, 17 Jul 2001 18:18:52 +0000 Subject: [PATCH] fix bogus uio->uio_offset check introduced in rev. 1.5, which effectively disabled loans for writes (a.k.a "direct write"), oops; use uio->uio_resid for the check instead don't bother updating uio->uio_offset in pipe_direct_write(), it's not used by upper layers anyway --- sys/kern/sys_pipe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 87d79feed93f..e03bf50d9e45 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_pipe.c,v 1.6 2001/07/17 06:05:28 jdolecek Exp $ */ +/* $NetBSD: sys_pipe.c,v 1.7 2001/07/17 18:18:52 jdolecek Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -1128,8 +1128,8 @@ retry: return (error); } - uio->uio_offset += bcnt; uio->uio_resid -= bcnt; + /* uio_offset not updated, not set/uset for write(2) */ return (0); } @@ -1222,7 +1222,7 @@ pipe_write(fp, offset, uio, cred, flags) * away on us. */ if ((uio->uio_iov[0].iov_len >= PIPE_MINDIRECT) && - (uio->uio_offset == 0) && + (uio->uio_resid == orig_resid) && (fp->f_flag & FNONBLOCK) == 0 && (wpipe->pipe_map.kva || (amountpipekva < limitpipekva))) { error = pipe_direct_write(wpipe, uio);