aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-10-07 21:01:47 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-10-07 21:01:47 +0200
commit8c0708a329618b20089eb9cedbe06522dd25d9be (patch)
tree3f4e3b93743ca02c4758a8e885b87b9147924c5d
parent305958dbd456d463a92c1fa4c85ceb69a8c7db32 (diff)
downloadbusybox-8c0708a329618b20089eb9cedbe06522dd25d9be.tar.gz
find: support "find . -delete" idiom - do not try rmdir(".")
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--findutils/find.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/findutils/find.c b/findutils/find.c
index f72cad7d1..bd7ccc323 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -768,7 +768,10 @@ ACTF(delete)
{
int rc;
if (S_ISDIR(statbuf->st_mode)) {
- rc = rmdir(fileName);
+ /* "find . -delete" skips rmdir(".") */
+ rc = 0;
+ if (NOT_LONE_CHAR(fileName, '.'))
+ rc = rmdir(fileName);
} else {
rc = unlink(fileName);
}