diff options
Diffstat (limited to 'libdiskfs/dir-rmdir.c')
-rw-r--r-- | libdiskfs/dir-rmdir.c | 24 |
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). */ |