authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2022-10-05 19:51:43-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2022-10-05 19:51:43-07:00
logdb0829c15ab883b9efe704414fcf8149a3d83026
tree0933f12d006d7f7cd5f7e36e52347d783d21fa6f
parent34f180901eaa0fcd5e3bddc6f353604da8bd7e1f

fs.Dir.deleteTree: Fix some handling of NotDir error in deleteFile calls

We don't control sub_path so it may contain directory components; therefore, NotDir is a potential error when acting on sub_path.

1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/fs.zig+2-2
......@@ -2187,6 +2187,7 @@ pub const Dir = struct {
21872187 } else |err| switch (err) {
21882188 error.FileNotFound => break :handle_entry,
21892189
2190 // Impossible because we do not pass any path separators.
21902191 error.NotDir => unreachable,
21912192
21922193 error.IsDir => {
......@@ -2268,8 +2269,6 @@ pub const Dir = struct {
22682269 } else |err| switch (err) {
22692270 error.FileNotFound => return,
22702271
2271 error.NotDir => unreachable,
2272
22732272 error.IsDir => {
22742273 treat_as_dir = true;
22752274 continue :handle_entry;
......@@ -2281,6 +2280,7 @@ pub const Dir = struct {
22812280 error.NameTooLong,
22822281 error.SystemResources,
22832282 error.ReadOnlyFileSystem,
2283 error.NotDir,
22842284 error.FileSystem,
22852285 error.FileBusy,
22862286 error.BadPathName,