Skip to content

Commit

Permalink
Rollup merge of #99937 - ChrisDenton:fix-remove-dir-all-win-7, r=josh…
Browse files Browse the repository at this point in the history
…triplett

Reset directory iteration in remove_dir_all

Fixes #99934
  • Loading branch information
matthiaskrgr authored Jul 30, 2022
2 parents c2f25db + 3bb6e4d commit a7a6441
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion std/src/sys/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,13 @@ fn remove_dir_all_iterative(f: &File, delete: fn(&File) -> io::Result<()>) -> io
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(
Expand Down

0 comments on commit a7a6441

Please sign in to comment.