summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-10-05 19:54:25 +0000
committerJim Meyering <jim@meyering.net>2002-10-05 19:54:25 +0000
commitd0d7266488822c214d953a92a6804988d8500c81 (patch)
tree59661efd838cd17ce5da9d4afa9d8d63c10d7576
parent1f4be66913580b8b438cf7896e23e3e5b6c044ce (diff)
downloadcoreutils-d0d7266488822c214d953a92a6804988d8500c81.tar.xz
(remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
don't recurse into directory, DIR.
-rw-r--r--src/remove.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/remove.c b/src/remove.c
index 335f86844..d8d2d31f3 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* Extracted from rm.c and librarified by Jim Meyering. */
+/* Extracted from rm.c and librarified, then rewritten by Jim Meyering. */
#ifdef _AIX
#pragma alloca
@@ -753,6 +753,13 @@ remove_entry (char const *filename, struct rm_options const *x,
#else
+ if (is_dir == T_YES && ! x->recursive)
+ {
+ error (0, EISDIR, _("cannot remove directory %s"),
+ quote (full_filename (filename)));
+ return RM_ERROR;
+ }
+
/* is_empty_directory is set iff it's ok to use rmdir.
Note that it's set only in interactive mode -- in which case it's
an optimization that arranges so that the user is asked just