X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/36d4ed873aad3e79bf874dc534e6f33579ae51d6..7e2a7a5c8fd83ec48fdef829aa44ff92c1717fbb:/usr/src/sys/kern/vfs_lookup.c diff --git a/usr/src/sys/kern/vfs_lookup.c b/usr/src/sys/kern/vfs_lookup.c index dc8526d265..d42e01209c 100644 --- a/usr/src/sys/kern/vfs_lookup.c +++ b/usr/src/sys/kern/vfs_lookup.c @@ -1,4 +1,4 @@ -/* vfs_lookup.c 4.31 82/11/17 */ +/* vfs_lookup.c 4.34 82/12/22 */ #include "../h/param.h" #include "../h/systm.h" @@ -159,7 +159,7 @@ dirloop2: * e.g. like "/." or ".". */ if (u.u_dent.d_name[0] == 0) { - if (flag) { + if (flag || lockparent) { u.u_error = ENOENT; goto bad; } @@ -723,17 +723,19 @@ blkatoff(ip, offset, res) * Inode supplied must be locked. */ dirempty(ip) - struct inode *ip; + register struct inode *ip; { register off_t off; struct direct dbuf; register struct direct *dp = &dbuf; - int error; + int error, count; for (off = 0; off < ip->i_size; off += dp->d_reclen) { error = rdwri(UIO_READ, ip, (caddr_t)dp, - sizeof (struct direct), off, 1, (int *)0); - if (error) + sizeof (struct direct), off, 1, &count); + count = sizeof (struct direct) - count; +#define MINDIRSIZ (sizeof (struct direct) - (MAXNAMLEN + 1)) + if (error || count < MINDIRSIZ || count < DIRSIZ(dp)) return (0); if (dp->d_ino == 0) continue;