Commit 992c02ab95

LemonBoy <thatlemon@gmail.com>
2021-05-20 14:43:04
std: Fix error in tlcsprng init sequence
The fallback case was actually switched with the success one.
1 parent 9910bfa
Changed files (1)
lib
std
lib/std/crypto/tlcsprng.zig
@@ -107,13 +107,9 @@ fn tlsCsprngFill(_: *const std.rand.Random, buffer: []u8) void {
                     break :wof;
                 } else |_| {}
 
-                os.madvise(
-                    wipe_mem.ptr,
-                    wipe_mem.len,
-                    os.MADV_WIPEONFORK,
-                ) catch {
+                if (os.madvise(wipe_mem.ptr, wipe_mem.len, os.MADV_WIPEONFORK)) |_| {
                     return initAndFill(buffer);
-                };
+                } else |_| {}
             }
 
             if (std.Thread.use_pthreads) {