summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-10-31 20:22:37 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-10-31 20:22:37 +0000
commitedf5e77e974b2242dd25bc86d2ad5a7b5b551ed9 (patch)
tree79cd06af3219bad28dd059e02b80066e7dcbe0ec /sys
parent60ad304181211af096fbd19500fd66e97dcc6586 (diff)
Fix reading large files; from NetBSD. Somehow this was overlooked
when earlier merges were done. Fixes PR 4250. ok millert@ deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/nfs/nfs_bio.c9
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) {