diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-07 21:01:47 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-07 21:01:47 +0200 |
commit | 8c0708a329618b20089eb9cedbe06522dd25d9be (patch) | |
tree | 3f4e3b93743ca02c4758a8e885b87b9147924c5d /findutils | |
parent | 305958dbd456d463a92c1fa4c85ceb69a8c7db32 (diff) | |
download | busybox-8c0708a329618b20089eb9cedbe06522dd25d9be.tar.gz |
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.c | 5 |
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); } |