Marco Gerards <[EMAIL PROTECTED]> writes: > I have a look at this patch tommorrow to check if it has the same > problem with my patch and send in a new patch or I'll say what the > problem is.
The patch worked perfectly for me! As I've promissed, I've included my version with this mail. Perhaps it can be useful. Thanks, Marco 2003-07-16 Marco Gerards <[EMAIL PROTECTED]> * dir-renamed.c (diskfs_rename_dir): Move the diskfs_lookup for REMOVE up to correctly check for access rights. Move the assertion to after the error check. Common subdirectories: /home/marco/src/hurdcvs/hurd/libdiskfs/CVS and libdiskfs/CVS diff -up /home/marco/src/hurdcvs/hurd/libdiskfs/dir-renamed.c libdiskfs/dir-renamed.c --- /home/marco/src/hurdcvs/hurd/libdiskfs/dir-renamed.c 2001-10-12 04:49:17.000000000 +0200 +++ libdiskfs/dir-renamed.c 2003-07-16 21:41:57.000000000 +0200 @@ -76,6 +76,7 @@ diskfs_rename_dir (struct node *fdp, str void *buf = alloca (diskfs_dirstat_size); struct dirstat *ds; struct dirstat *tmpds; + struct dirstat *remds = 0; mutex_lock (&tdp->lock); diskfs_nref (tdp); /* reference and lock will get consumed by @@ -120,6 +121,17 @@ diskfs_rename_dir (struct node *fdp, str if (err && err != ENOENT) goto out; + ds = buf; + mutex_unlock (&fnp->lock); + remds = alloca (diskfs_dirstat_size); + err = diskfs_lookup (fdp, fromname, REMOVE, &tmpnp, remds, fromcred); + + if (err) + goto out; + + assert (tmpnp == fnp); + diskfs_nrele (tmpnp); + /* 2: Set our .. to point to the new parent */ if (fdp != tdp) { @@ -196,15 +208,9 @@ diskfs_rename_dir (struct node *fdp, str goto out; /* 4: Remove the entry in fdp. */ - ds = buf; - mutex_unlock (&fnp->lock); - err = diskfs_lookup (fdp, fromname, REMOVE, &tmpnp, ds, fromcred); - assert (tmpnp == fnp); - diskfs_nrele (tmpnp); - if (err) - goto out; - diskfs_dirremove (fdp, fnp, fromname, ds); + diskfs_dirremove (fdp, fnp, fromname, remds); + remds = 0; ds = 0; fnp->dn_stat.st_nlink--; fnp->dn_set_ctime = 1; @@ -225,5 +231,7 @@ diskfs_rename_dir (struct node *fdp, str mutex_unlock (&fnp->lock); if (ds) diskfs_drop_dirstat (tdp, ds); + if (remds) + diskfs_drop_dirstat (fdp, remds); return err; } _______________________________________________ Bug-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-hurd