Commit 221286433a

Andrew Kelley <superjoe30@gmail.com>
2017-06-20 03:39:44
don't call c.getrandom because older libcs don't have it
See #397
1 parent 62b23f5
Changed files (1)
std
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) {