diff --git a/src/shared/rm-rf.c b/src/shared/rm-rf.c index 4664215e90..e1dc4024dc 100644 --- a/src/shared/rm-rf.c +++ b/src/shared/rm-rf.c @@ -365,6 +365,10 @@ 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) {