[git commit] find: support "find . -delete" idiom - do not try rmdir(".")
Denys Vlasenko
vda.linux at googlemail.com
Wed Oct 7 19:01:47 UTC 2015
commit: http://git.busybox.net/busybox/commit/?id=8c0708a329618b20089eb9cedbe06522dd25d9be
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
findutils/find.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/findutils/find.c b/findutils/find.c
index f72cad7..bd7ccc3 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);
}
More information about the busybox-cvs
mailing list