authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2020-03-03 00:03:19-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-03 03:07:12-05:00
logd7579a2fcb0edaa1f6036101d00316abccac0c7e
treefbf429e419a20f4a2411c1ec10b8ec3be9dbb189
parent00be934569d25e3b041091ff63a4cf6c456d1403

Fix std.os.unlinkatW for absolute paths

RootDirectory can't be set in ObjectAttributes if ObjectName is an absolute path. Fixes #4606

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

lib/std/os.zig+1-1
...@@ -1438,7 +1438,7 @@ pub fn unlinkatW(dirfd: fd_t, sub_path_w: [*:0]const u16, flags: u32) UnlinkatEr...@@ -1438,7 +1438,7 @@ pub fn unlinkatW(dirfd: fd_t, sub_path_w: [*:0]const u16, flags: u32) UnlinkatEr
14381438
1439 var attr = w.OBJECT_ATTRIBUTES{1439 var attr = w.OBJECT_ATTRIBUTES{
1440 .Length = @sizeOf(w.OBJECT_ATTRIBUTES),1440 .Length = @sizeOf(w.OBJECT_ATTRIBUTES),
1441 .RootDirectory = dirfd,1441 .RootDirectory = if (std.fs.path.isAbsoluteWindowsW(sub_path_w)) null else dirfd,
1442 .Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.1442 .Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.
1443 .ObjectName = &nt_name,1443 .ObjectName = &nt_name,
1444 .SecurityDescriptor = null,1444 .SecurityDescriptor = null,