From 117d15ed7a230d065cf88faa8156c08f7160e08b Mon Sep 17 00:00:00 2001 From: LeRoyce Pearson Date: Tue, 7 Apr 2020 16:49:37 -0600 Subject: [PATCH] Fix file locking on windows The share_access bitfield was being ORed with what was supposed to be parts of the default value, meaning that the share_access would be more permissive than expected. --- lib/std/os/windows.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index efc85d38a..817244e08 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -136,7 +136,7 @@ pub fn OpenFileW( .SecurityQualityOfService = null, }; var io: IO_STATUS_BLOCK = undefined; - const share_access = share_access_opt orelse FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE; + const share_access = share_access_opt orelse (FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE); var delay: usize = 1; while (true) {