commit 2a41d458eff5cde0ae15bf72f3d62c9a6630d618 Author: Gleb Kurtsou Date: Sun Oct 17 23:40:11 2010 +0300 Skip empty directory entries (entries with zero inode number) during name lookup diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 2e74844..ccd97cd 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -1177,7 +1177,7 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td) edp = (struct dirent*)&buf[sizeof(buf) - uio.uio_resid]; for (dp = (struct dirent*)buf; !error && dp < edp; dp = (struct dirent*)((caddr_t)dp + dp->d_reclen)) { - if (dp->d_type == DT_WHT || + if (dp->d_type == DT_WHT || dp->d_fileno == 0 || (dp->d_namlen == 1 && dp->d_name[0] == '.') || (dp->d_namlen == 2 && !bcmp(dp->d_name, "..", 2))) continue; diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 195e735..9e2ec90 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -338,7 +338,7 @@ dirent_exists(struct vnode *vp, const char *dirname, struct thread *td) if (error) goto out; - if ((dp->d_type != DT_WHT) && + if (dp->d_type != DT_WHT && dp->d_fileno != 0 && !strcmp(dp->d_name, dirname)) { found = 1; goto out;