summaryrefslogtreecommitdiff
path: root/libdiskfs/dir-clear.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-09-13 16:36:24 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-09-13 16:36:24 +0000
commit6be67229bc918b5aae4e31621c5d769b629697b1 (patch)
treeae5a9a5f07afbb2bb260a3a7d1e9de0c5b0bcd92 /libdiskfs/dir-clear.c
parent4d5e699b41a64698b63167cf638d2712cae9ec52 (diff)
(diskfs_clear_directory): Set the fourth arg in REMOVE lookup calls in
accord with change in rules for the lookup call.
Diffstat (limited to 'libdiskfs/dir-clear.c')
-rw-r--r--libdiskfs/dir-clear.c18
1 files changed, 13 insertions, 5 deletions
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)