If we read zero bytes from the directory, early out with ENOENT

rather than forging ahead and interpreting garbage buffer content
and dirent structures.

This change backs out r211684 which was essentially a no-op.

MFC after:	1 week
This commit is contained in:
Brian Somers 2010-08-25 18:09:51 +00:00
parent 194270c84b
commit c2d844d814

View File

@ -281,9 +281,13 @@ get_next_dirent(struct vnode *vp, struct dirent **dpp, char *dirbuf,
if (error)
return (error);
*cpos = dirbuf;
*len = uio.uio_offset - *off;
*off = uio.uio_offset;
*cpos = dirbuf;
*len = (dirbuflen - uio.uio_resid);
if (*len == 0)
return (ENOENT);
}
dp = (struct dirent *)(*cpos);