aboutsummaryrefslogtreecommitdiff
path: root/libdiskfs/dir-rmdir.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-04-16 19:52:34 +0000
committerThomas Bushnell <thomas@gnu.org>1997-04-16 19:52:34 +0000
commit2e77e9a4d22a5e29af1b9d8d4d24ed7e35b94325 (patch)
treecc58a903c1883f6270b8156405889d4061aa8b3c /libdiskfs/dir-rmdir.c
parent1c1dc4983882eaaf1fc41e129a985c86d4456235 (diff)
downloadhurd-2e77e9a4d22a5e29af1b9d8d4d24ed7e35b94325.tar.gz
hurd-2e77e9a4d22a5e29af1b9d8d4d24ed7e35b94325.tar.bz2
hurd-2e77e9a4d22a5e29af1b9d8d4d24ed7e35b94325.zip
Mon Feb 24 14:40:02 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* dir-rmdir.c (diskfs_S_dir_rmdir): Check EBUSY-when-translated error before ENOTDIR-when-not-dir.
Diffstat (limited to 'libdiskfs/dir-rmdir.c')
-rw-r--r--libdiskfs/dir-rmdir.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libdiskfs/dir-rmdir.c b/libdiskfs/dir-rmdir.c
index a5274d71..a6387023 100644
--- a/libdiskfs/dir-rmdir.c
+++ b/libdiskfs/dir-rmdir.c
@@ -41,10 +41,20 @@ diskfs_S_dir_rmdir (struct protid *dircred,
error = diskfs_lookup (dnp, name, REMOVE, &np, ds, dircred);
if (error == EAGAIN)
error = ENOTEMPTY;
- else if (np && !S_ISDIR (np->dn_stat.st_mode))
+
+ if (np)
{
- diskfs_nput (np);
- error = ENOTDIR;
+ if ((np->dn_stat.st_mode & S_IPTRANS)
+ || fshelp_translated (&np->transbox))
+ {
+ diskfs_nput (np);
+ error = EBUSY;
+ }
+ if (!S_ISDIR (np->dn_stat.st_mode))
+ {
+ diskfs_nput (np);
+ error = ENOTDIR;
+ }
}
if (error)
{
@@ -62,14 +72,6 @@ diskfs_S_dir_rmdir (struct protid *dircred,
return EINVAL;
}
- if ((np->dn_stat.st_mode & S_IPTRANS) || fshelp_translated (&np->transbox))
- {
- diskfs_drop_dirstat (dnp, ds);
- diskfs_nput (np);
- mutex_unlock (&dnp->lock);
- return EBUSY;
- }
-
/* Verify the directory is empty (and valid). (Rmdir ".." won't be
valid since ".." will contain a reference to the current directory and
thus be non-empty). */