summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/remove.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/remove.c b/src/remove.c
index ed9938429..7c79d10bf 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -576,6 +576,13 @@ prompt (Dirstack_state const *ds, char const *filename,
return RM_ERROR;
}
+ if (S_ISDIR (sbuf.st_mode) && !x->recursive)
+ {
+ error (0, EISDIR, _("cannot remove directory %s"),
+ quote (full_filename (filename)));
+ return RM_ERROR;
+ }
+
/* Using permissions doesn't make sense for symlinks. */
if (S_ISLNK (sbuf.st_mode))
{