diff options
| author | Ryan Liptak <squeek502@hotmail.com> | 2023-08-11 14:19:59 -0700 |
|---|---|---|
| committer | Ryan Liptak <squeek502@hotmail.com> | 2023-08-11 18:58:40 -0700 |
| commit | 3f9294c73501f55bcba1fe8b5da1ad2f2b0af9e5 (patch) | |
| tree | 86fce350a6c04eeffbc28f9860865090e8115256 /lib/std/child_process.zig | |
| parent | ac95cfe4496a5504b42bf37b02f34eff390fe956 (diff) | |
| download | zig-3f9294c73501f55bcba1fe8b5da1ad2f2b0af9e5.tar.gz zig-3f9294c73501f55bcba1fe8b5da1ad2f2b0af9e5.zip | |
Windows: Fix `TooManyParentDirs` handling for paths that shouldn't be cwd-relative
Previously, a relative path like `..` would:
- Attempt to be normalized (i.e. remove . and .. without any path resolution), but would error with TooManyParentDirs
- This would make wToPrefixedFileW run it through `RtlGetFullPathName_U` to do the necessary path resolution, but `RtlGetFullPathName_U` always resolves relative paths relative to the CWD
Instead, when TooManyParentDirs occurs, we now look up the path of the passed in `dir` (if it's non-null) and append the relative path to it before giving it to `RtlGetFullPathName_U`. If `dir` is null, then we just give it RtlGetFullPathName_U directly and let it resolve it relative to the CWD.
Closes #16779
Diffstat (limited to 'lib/std/child_process.zig')
| -rw-r--r-- | lib/std/child_process.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig index efa76b4e72..6ddb92f55d 100644 --- a/lib/std/child_process.zig +++ b/lib/std/child_process.zig @@ -961,7 +961,7 @@ fn windowsCreateProcessPathExt( try dir_buf.append(allocator, 0); defer dir_buf.shrinkRetainingCapacity(dir_path_len); const dir_path_z = dir_buf.items[0 .. dir_buf.items.len - 1 :0]; - const prefixed_path = try windows.wToPrefixedFileW(dir_path_z); + const prefixed_path = try windows.wToPrefixedFileW(null, dir_path_z); break :dir fs.cwd().openDirW(prefixed_path.span().ptr, .{}, true) catch return error.FileNotFound; }; defer dir.close(); |
