| ... | ... | @@ -2120,18 +2120,18 @@ pub fn dirOpenFileWtf16( |
| 2120 | 2120 | .BAD_NETWORK_NAME => return error.NetworkNotFound, // \\server was found but \\server\share wasn't |
| 2121 | 2121 | .NO_MEDIA_IN_DEVICE => return error.NoDevice, |
| 2122 | 2122 | .INVALID_PARAMETER => |err| return w.statusBug(err), |
| 2123 | | .SHARING_VIOLATION => return error.AccessDenied, |
| 2124 | | .ACCESS_DENIED => { |
| 2123 | .SHARING_VIOLATION => { |
| 2125 | 2124 | // This occurs if the file attempting to be opened is a running |
| 2126 | 2125 | // executable. However, there's a kernel bug: the error may be |
| 2127 | 2126 | // incorrectly returned for an indeterminate amount of time |
| 2128 | 2127 | // after an executable file is closed. Here we work around the |
| 2129 | 2128 | // kernel bug with retry attempts. |
| 2130 | | if (attempt - max_attempts == 0) return error.AccessDenied; |
| 2129 | if (attempt - max_attempts == 0) return error.SharingViolation; |
| 2131 | 2130 | _ = w.kernel32.SleepEx((@as(u32, 1) << attempt) >> 1, w.TRUE); |
| 2132 | 2131 | attempt += 1; |
| 2133 | 2132 | continue; |
| 2134 | 2133 | }, |
| 2134 | .ACCESS_DENIED => return error.AccessDenied, |
| 2135 | 2135 | .PIPE_BUSY => return error.PipeBusy, |
| 2136 | 2136 | .PIPE_NOT_AVAILABLE => return error.NoDevice, |
| 2137 | 2137 | .OBJECT_PATH_SYNTAX_BAD => |err| return w.statusBug(err), |
| ... | ... | @@ -2146,7 +2146,7 @@ pub fn dirOpenFileWtf16( |
| 2146 | 2146 | // finished with the deletion operation, and so this CreateFile |
| 2147 | 2147 | // call has failed. Here, we simulate the kernel bug being |
| 2148 | 2148 | // fixed by sleeping and retrying until the error goes away. |
| 2149 | | if (attempt - max_attempts == 0) return error.AccessDenied; |
| 2149 | if (attempt - max_attempts == 0) return error.SharingViolation; |
| 2150 | 2150 | _ = w.kernel32.SleepEx((@as(u32, 1) << attempt) >> 1, w.TRUE); |
| 2151 | 2151 | attempt += 1; |
| 2152 | 2152 | continue; |