| ... | @@ -59,11 +59,9 @@ pub fn getRandomBytes(buf: []u8) -> %void { | ... | @@ -59,11 +59,9 @@ pub fn getRandomBytes(buf: []u8) -> %void { |
| 59 | while (true) { | 59 | while (true) { |
| 60 | const err = switch (builtin.os) { | 60 | const err = switch (builtin.os) { |
| 61 | Os.linux => { | 61 | Os.linux => { |
| 62 | if (builtin.link_libc) { | 62 | // TODO check libc version and potentially call c.getrandom. |
| 63 | if (c.getrandom(buf.ptr, buf.len, 0) == -1) *c._errno() else 0 | 63 | // See #397 |
| 64 | } else { | 64 | posix.getErrno(posix.getrandom(buf.ptr, buf.len, 0)) |
| 65 | posix.getErrno(posix.getrandom(buf.ptr, buf.len, 0)) | | |
| 66 | } | | |
| 67 | }, | 65 | }, |
| 68 | Os.darwin, Os.macosx, Os.ios => { | 66 | Os.darwin, Os.macosx, Os.ios => { |
| 69 | if (builtin.link_libc) { | 67 | if (builtin.link_libc) { |