From 992c02ab95e8297a1558bcf011f15a5cf1cd8e1b Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Thu, 20 May 2021 14:43:04 +0200 Subject: [PATCH] std: Fix error in tlcsprng init sequence The fallback case was actually switched with the success one. --- lib/std/crypto/tlcsprng.zig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/std/crypto/tlcsprng.zig b/lib/std/crypto/tlcsprng.zig index 8a2c24916b..1e39b125f6 100644 --- a/lib/std/crypto/tlcsprng.zig +++ b/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) {