From 6be67229bc918b5aae4e31621c5d769b629697b1 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Wed, 13 Sep 1995 16:36:24 +0000 Subject: (diskfs_clear_directory): Set the fourth arg in REMOVE lookup calls in accord with change in rules for the lookup call. --- libdiskfs/dir-clear.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'libdiskfs') diff --git a/libdiskfs/dir-clear.c b/libdiskfs/dir-clear.c index 9d5a6ea0..c1033a03 100644 --- a/libdiskfs/dir-clear.c +++ b/libdiskfs/dir-clear.c @@ -27,12 +27,17 @@ diskfs_clear_directory (struct node *dp, { error_t err; struct dirstat *ds = alloca (diskfs_dirstat_size); - + struct node *np; + /* Find and remove the `.' entry. */ - err = diskfs_lookup (dp, ".", REMOVE, 0, ds, cred); + err = diskfs_lookup (dp, ".", REMOVE, &np, ds, cred); assert (err != ENOENT); if (!err) - err = diskfs_dirremove (dp, ds); + { + assert (np == dp); + err = diskfs_dirremove (dp, ds); + diskfs_nrele (np); + } else diskfs_drop_dirstat (dp, ds); if (err) @@ -43,10 +48,13 @@ diskfs_clear_directory (struct node *dp, dp->dn_set_ctime = 1; /* Find and remove the `..' entry. */ - err = diskfs_lookup (dp, "..", REMOVE | SPEC_DOTDOT, 0, ds, cred); + err = diskfs_lookup (dp, "..", REMOVE | SPEC_DOTDOT, &np, ds, cred); assert (err != ENOENT); if (!err) - err = diskfs_dirremove (dp, ds); + { + assert (np == pdp); + err = diskfs_dirremove (dp, ds); + } else diskfs_drop_dirstat (dp, ds); if (err) -- cgit v1.2.3