aboutsummaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
authorGravatar Denys Vlasenko <vda.linux@googlemail.com>2015-10-07 21:01:47 +0200
committerGravatar Denys Vlasenko <vda.linux@googlemail.com>2015-10-07 21:01:47 +0200
commit8c0708a329618b20089eb9cedbe06522dd25d9be (patch)
tree3f4e3b93743ca02c4758a8e885b87b9147924c5d /findutils
parent305958dbd456d463a92c1fa4c85ceb69a8c7db32 (diff)
downloadbusybox-8c0708a329618b20089eb9cedbe06522dd25d9be.tar.gz
busybox-8c0708a329618b20089eb9cedbe06522dd25d9be.tar.bz2
find: support "find . -delete" idiom - do not try rmdir(".")
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'findutils')
-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);
}