From 59ccbad65eaa9a442b4f0f46bf68a413047ee6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 23 Oct 2023 13:56:38 +0200 Subject: [PATCH] Revert "rm-rf: Make sure we rewinddir() before readdir()" This reverts commit 6bbb893b90e2dcb05fb310ba4608f9c9dc587845. Let's try a different approach where we make sure that all callers only pass in a fd that is "clean", i.e. at offset 0. The majority of callers of this function (both direct and indirect) pass a freshly-opened fd, so the rewind call is not needed. --- src/shared/rm-rf.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/shared/rm-rf.c b/src/shared/rm-rf.c index e1dc4024dc..4664215e90 100644 --- a/src/shared/rm-rf.c +++ b/src/shared/rm-rf.c @@ -365,10 +365,6 @@ static int rm_rf_children_impl( strna(path)); } } - - /* Make sure we reset the iterator since we don't know the state the passed in file - * descriptor is in. */ - rewinddir(d); } FOREACH_DIRENT_ALL(de, d, return -errno) {