aboutsummaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-06-19 21:39:44 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-06-19 21:39:44 -0400
commit221286433aa5825dcb177596dbf697d873c6f1cb (patch)
tree5965523c3081016ee5a4da928c7421893676abe6 /std
parent62b23f5da5a29f54499f5339bc0f98c06e27af8f (diff)
downloadzig-221286433aa5825dcb177596dbf697d873c6f1cb.tar.gz
zig-221286433aa5825dcb177596dbf697d873c6f1cb.zip
don't call c.getrandom because older libcs don't have it
See #397
Diffstat (limited to 'std')
-rw-r--r--std/os/index.zig8
1 files changed, 3 insertions, 5 deletions
diff --git a/std/os/index.zig b/std/os/index.zig
index d07cb6fff3..54578f563c 100644
--- a/std/os/index.zig
+++ b/std/os/index.zig
@@ -59,11 +59,9 @@ pub fn getRandomBytes(buf: []u8) -> %void {
while (true) {
const err = switch (builtin.os) {
Os.linux => {
- if (builtin.link_libc) {
- if (c.getrandom(buf.ptr, buf.len, 0) == -1) *c._errno() else 0
- } else {
- posix.getErrno(posix.getrandom(buf.ptr, buf.len, 0))
- }
+ // TODO check libc version and potentially call c.getrandom.
+ // See #397
+ posix.getErrno(posix.getrandom(buf.ptr, buf.len, 0))
},
Os.darwin, Os.macosx, Os.ios => {
if (builtin.link_libc) {