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/ChangeLog | 8 +++++++- libdiskfs/dir-rmdir.c | 24 +++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'libdiskfs') diff --git a/libdiskfs/ChangeLog b/libdiskfs/ChangeLog index 6a6781f4..1eebec53 100644 --- a/libdiskfs/ChangeLog +++ b/libdiskfs/ChangeLog @@ -4,6 +4,11 @@ Mon Feb 24 17:22:05 1997 Miles Bader inode number to fshelp_get_identity when creating a shadow root fsid, not INUM. +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. + Sat Feb 22 00:00:32 1997 Miles Bader * io-stat.c (diskfs_S_io_stat): Mark shadow roots with S_IROOT. @@ -62,7 +67,8 @@ Wed Feb 12 14:23:15 1997 Miles Bader Get rid of depth parameters to diskfs_lookup. Deal properly with EAGAIN return from diskfs_lookup. Replace references to dotdotport with root_parent. - * dir-unlink.c (diskfs_S_dir_unlink): Don't pass depth args to diskfs_lookup. + * dir-unlink.c (diskfs_S_dir_unlink): Don't pass depth args to + diskfs_lookup. * dir-rmdir.c (diskfs_S_dir_rmdir): Likewise. * dir-renamed.c (diskfs_rename_dir, checkpath): Likewise. * dir-rename.c (diskfs_S_dir_rename): Likewise. 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