From 2e77e9a4d22a5e29af1b9d8d4d24ed7e35b94325 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Wed, 16 Apr 1997 19:52:34 +0000 Subject: Mon Feb 24 14:40:02 1997 Thomas Bushnell, n/BSG * dir-rmdir.c (diskfs_S_dir_rmdir): Check EBUSY-when-translated error before ENOTDIR-when-not-dir. --- libdiskfs/dir-rmdir.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'libdiskfs/dir-rmdir.c') 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). */ -- cgit v1.2.3