rm-rf: Make sure we rewinddir() before readdir()
We don't know what state the passed in file descriptor is in. Let's make sure we rewind it before iterating over it. Fixes #29606
This commit is contained in:
committed by
Luca Boccassi
parent
cf37171890
commit
6bbb893b90
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user