diff options
author | 2005-10-31 20:22:36 +0000 | |
---|---|---|
committer | 2005-10-31 20:22:36 +0000 | |
commit | 5d1b44a99d848c16d7b721022e89cb8fb957f3f7 (patch) | |
tree | 88d0aa00ea4cf33b39d885e38822e2ce3e4a0861 | |
parent | add copyright from the original FreeBSD man page. (diff) | |
download | wireguard-openbsd-5d1b44a99d848c16d7b721022e89cb8fb957f3f7.tar.xz wireguard-openbsd-5d1b44a99d848c16d7b721022e89cb8fb957f3f7.zip |
Fix reading large files; from NetBSD. Somehow this was overlooked
when earlier merges were done. Fixes PR 4250. ok millert@ deraadt@
-rw-r--r-- | sys/nfs/nfs_bio.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 3630b55ab33..c942a6db68e 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_bio.c,v 1.40 2004/08/03 17:11:48 marius Exp $ */ +/* $OpenBSD: nfs_bio.c,v 1.41 2005/10/31 20:22:36 otto Exp $ */ /* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */ /* @@ -80,6 +80,7 @@ nfs_bioread(vp, uio, ioflag, cred) daddr_t lbn, bn, rabn; caddr_t baddr; int got_buf = 0, nra, error = 0, n = 0, on = 0, not_readin; + off_t offdiff; #ifdef DIAGNOSTIC if (uio->uio_rw != UIO_READ) @@ -198,9 +199,9 @@ again: } } n = min((unsigned)(biosize - on), uio->uio_resid); - diff = np->n_size - uio->uio_offset; - if (diff < n) - n = diff; + offdiff = np->n_size - uio->uio_offset; + if (offdiff < (off_t)n) + n = (int)offdiff; if (not_readin && n > 0) { if (on < bp->b_validoff || (on + n) > bp->b_validend) { if (!got_buf) { |