From 1d80c9540af9b3c577c8cca740247b968e7e59f1 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Wed, 29 Oct 2025 21:00:22 -0400 Subject: [PATCH] Threaded: fix safety crashes --- lib/std/Io/Threaded.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index 168395d335..ae89b4b20a 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -2133,7 +2133,7 @@ pub fn dirOpenFileWtf16( // incorrectly returned for an indeterminate amount of time // after an executable file is closed. Here we work around the // kernel bug with retry attempts. - if (attempt - max_attempts == 0) return error.SharingViolation; + if (max_attempts - attempt == 0) return error.SharingViolation; _ = w.kernel32.SleepEx((@as(u32, 1) << attempt) >> 1, w.TRUE); attempt += 1; continue; @@ -2153,7 +2153,7 @@ pub fn dirOpenFileWtf16( // finished with the deletion operation, and so this CreateFile // call has failed. Here, we simulate the kernel bug being // fixed by sleeping and retrying until the error goes away. - if (attempt - max_attempts == 0) return error.SharingViolation; + if (max_attempts - attempt == 0) return error.SharingViolation; _ = w.kernel32.SleepEx((@as(u32, 1) << attempt) >> 1, w.TRUE); attempt += 1; continue;