From: Denys Vlasenko Date: Wed, 7 Oct 2015 19:01:47 +0000 (+0200) Subject: find: support "find . -delete" idiom - do not try rmdir(".") X-Git-Tag: 1_24_0~23 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8c0708a329618b20089eb9cedbe06522dd25d9be;p=oweals%2Fbusybox.git find: support "find . -delete" idiom - do not try rmdir(".") Signed-off-by: Denys Vlasenko --- 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); }