diff options
| author | Chris Denton <christophersdenton@gmail.com> | 2022-07-30 05:28:38 +0100 |
|---|---|---|
| committer | Chris Denton <christophersdenton@gmail.com> | 2022-07-30 05:28:38 +0100 |
| commit | aac8a0a518048d6102c1342835904cfb2ebdab63 (patch) | |
| tree | 780d6ccf44128f3fc8e975688a4eb5038a53607c /library/std/src/sys/windows | |
| parent | 9fa62f2d853d9d475601c5150193901207188052 (diff) | |
| download | rust-aac8a0a518048d6102c1342835904cfb2ebdab63.tar.gz rust-aac8a0a518048d6102c1342835904cfb2ebdab63.zip | |
Reset directory iteration in remove_dir_all
Diffstat (limited to 'library/std/src/sys/windows')
| -rw-r--r-- | library/std/src/sys/windows/fs.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs index 4d3162f1254..c96bcf41d51 100644 --- a/library/std/src/sys/windows/fs.rs +++ b/library/std/src/sys/windows/fs.rs @@ -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( |
