Skip to content

Commit 2212864

Browse files
committed
don't call c.getrandom because older libcs don't have it
See #397
1 parent 62b23f5 commit 2212864

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

std/os/index.zig

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,9 @@ pub fn getRandomBytes(buf: []u8) -> %void {
5959
while (true) {
6060
const err = switch (builtin.os) {
6161
Os.linux => {
62-
if (builtin.link_libc) {
63-
if (c.getrandom(buf.ptr, buf.len, 0) == -1) *c._errno() else 0
64-
} else {
65-
posix.getErrno(posix.getrandom(buf.ptr, buf.len, 0))
66-
}
62+
// TODO check libc version and potentially call c.getrandom.
63+
// See #397
64+
posix.getErrno(posix.getrandom(buf.ptr, buf.len, 0))
6765
},
6866
Os.darwin, Os.macosx, Os.ios => {
6967
if (builtin.link_libc) {

0 commit comments

Comments
 (0)