aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os.zig
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2020-03-03 00:03:19 -0800
committerAndrew Kelley <andrew@ziglang.org>2020-03-03 03:07:12 -0500
commitd7579a2fcb0edaa1f6036101d00316abccac0c7e (patch)
treefbf429e419a20f4a2411c1ec10b8ec3be9dbb189 /lib/std/os.zig
parent00be934569d25e3b041091ff63a4cf6c456d1403 (diff)
downloadzig-d7579a2fcb0edaa1f6036101d00316abccac0c7e.tar.gz
zig-d7579a2fcb0edaa1f6036101d00316abccac0c7e.zip
Fix std.os.unlinkatW for absolute paths
RootDirectory can't be set in ObjectAttributes if ObjectName is an absolute path. Fixes #4606
Diffstat (limited to 'lib/std/os.zig')
-rw-r--r--lib/std/os.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 127ada8fe5..fbfef4ac4c 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -1438,7 +1438,7 @@ pub fn unlinkatW(dirfd: fd_t, sub_path_w: [*:0]const u16, flags: u32) UnlinkatEr
var attr = w.OBJECT_ATTRIBUTES{
.Length = @sizeOf(w.OBJECT_ATTRIBUTES),
- .RootDirectory = dirfd,
+ .RootDirectory = if (std.fs.path.isAbsoluteWindowsW(sub_path_w)) null else dirfd,
.Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.
.ObjectName = &nt_name,
.SecurityDescriptor = null,