Rollup merge of #99937 - ChrisDenton:fix-remove-dir-all-win-7, r=joshtriplett

Reset directory iteration in remove_dir_all

Fixes #99934
This commit is contained in:
Matthias Krüger 2022-07-30 22:51:00 +02:00 committed by GitHub
commit 656cd3a48f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1035,11 +1035,13 @@ fn copy_handle(f: &File) -> mem::ManuallyDrop<File> {
unsafe { mem::ManuallyDrop::new(File::from_raw_handle(f.as_raw_handle())) }
}
let mut restart = true;
while let Some(dir) = dirlist.last() {
let dir = copy_handle(dir);
// Fill the buffer and iterate the entries.
let more_data = dir.fill_dir_buff(&mut buffer, false)?;
let more_data = dir.fill_dir_buff(&mut buffer, restart)?;
restart = false;
for (name, is_directory) in buffer.iter() {
if is_directory {
let child_dir = open_link_no_reparse(