authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-06-19 21:39:44-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-06-19 21:39:44-04:00
log221286433aa5825dcb177596dbf697d873c6f1cb
tree5965523c3081016ee5a4da928c7421893676abe6
parent62b23f5da5a29f54499f5339bc0f98c06e27af8f

don't call c.getrandom because older libcs don't have it

See #397

1 files changed, 3 insertions(+), 5 deletions(-)

std/os/index.zig+3-5
......@@ -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) {