From c50b21161bdf96ee7fb7064da1ae997517e360a7 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 27 Jul 2003 19:47:25 +0000 Subject: (prompt) [! recursive]: Don't prompt about unwritable directories, as required by POSIX. Reported by Karl Berry. --- src/remove.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') 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)) { -- cgit v1.2.3-70-g09d2