mirror of
https://github.com/ziglang/zig.git
synced 2026-01-07 14:03:26 +00:00
Merge pull request #25122 from linusg/fix-getrandombytesdevurandom
std.posix: Fix getRandomBytesDevURandom()
This commit is contained in:
commit
a11dfaf61a
@ -10353,7 +10353,7 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_
|
||||
|
||||
pub const arc4random_buf = switch (native_os) {
|
||||
.linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {},
|
||||
.dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf,
|
||||
.dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .serenity, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf,
|
||||
else => {},
|
||||
};
|
||||
pub const getentropy = switch (native_os) {
|
||||
|
||||
@ -672,7 +672,7 @@ fn getRandomBytesDevURandom(buf: []u8) !void {
|
||||
|
||||
const file: fs.File = .{ .handle = fd };
|
||||
var file_reader = file.readerStreaming(&.{});
|
||||
file_reader.readSliceAll(buf) catch return error.Unexpected;
|
||||
file_reader.interface.readSliceAll(buf) catch return error.Unexpected;
|
||||
}
|
||||
|
||||
/// Causes abnormal process termination.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user