msdosfs_readdir(): set iovec offset correctly so that some long filename
entries won't be ignored when contents of the directory don't fit in user buffer all at once. Fixes kern/4492 by Rick Byers <rickb@iaw.on.ca>.
This commit is contained in:
parent
8e930a51fe
commit
fe54414362
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.87 1999/08/19 03:42:23 itohy Exp $ */
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.88 1999/11/04 23:08:57 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -1469,7 +1469,7 @@ msdosfs_readdir(v)
|
||||
struct uio *uio = ap->a_uio;
|
||||
off_t *cookies = NULL;
|
||||
int ncookies = 0, nc = 0;
|
||||
off_t offset;
|
||||
off_t offset, uio_off;
|
||||
int chksum = -1;
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
@ -1503,6 +1503,7 @@ msdosfs_readdir(v)
|
||||
return (EINVAL);
|
||||
lost = uio->uio_resid - count;
|
||||
uio->uio_resid = count;
|
||||
uio_off = uio->uio_offset;
|
||||
|
||||
if (ap->a_ncookies) {
|
||||
nc = uio->uio_resid / 16;
|
||||
@ -1554,6 +1555,7 @@ msdosfs_readdir(v)
|
||||
if (error)
|
||||
goto out;
|
||||
offset += sizeof(struct direntry);
|
||||
uio_off = offset;
|
||||
if (cookies) {
|
||||
*cookies++ = offset;
|
||||
ncookies++;
|
||||
@ -1668,6 +1670,7 @@ msdosfs_readdir(v)
|
||||
brelse(bp);
|
||||
goto out;
|
||||
}
|
||||
uio_off = offset + sizeof(struct direntry);
|
||||
if (cookies) {
|
||||
*cookies++ = offset + sizeof(struct direntry);
|
||||
ncookies++;
|
||||
@ -1681,7 +1684,7 @@ msdosfs_readdir(v)
|
||||
}
|
||||
|
||||
out:
|
||||
uio->uio_offset = offset;
|
||||
uio->uio_offset = uio_off;
|
||||
uio->uio_resid += lost;
|
||||
if (dep->de_FileSize - (offset - bias) <= 0)
|
||||
*ap->a_eofflag = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user