summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-07-27 19:47:25 +0000
committerJim Meyering <jim@meyering.net>2003-07-27 19:47:25 +0000
commitc50b21161bdf96ee7fb7064da1ae997517e360a7 (patch)
tree0114f2d79d48fb56d5144d2409232ba302e555fd
parente8f7ac5e252a2cce4cde0136f595c8432b97a381 (diff)
downloadcoreutils-c50b21161bdf96ee7fb7064da1ae997517e360a7.tar.xz
(prompt) [! recursive]: Don't prompt about unwritable
directories, as required by POSIX. Reported by Karl Berry.
-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))
{