| author | |
| committer | |
| log | c0c228b758150e017185dc280ef020ec3b7efdcf |
| tree | 5983981ffd565f03269941a2d37a2047afb06eae |
| parent | 6cb4cac5cd1c68f41c62a3c23b09513988337c8d |
1 files changed, 5 insertions(+), 0 deletions(-)
std/os.zig+5| ... | ... | @@ -133,6 +133,11 @@ fn getRandomBytesDevURandom(buf: []u8) !void { |
| 133 | 133 | const fd = try openC(c"/dev/urandom", O_RDONLY | O_CLOEXEC, 0); |
| 134 | 134 | defer close(fd); |
| 135 | 135 | |
| 136 | const st = try fstat(fd); | |
| 137 | if (!S_ISCHR(st.mode)) { | |
| 138 | return OpenError.Unexpected; | |
| 139 | } | |
| 140 | ||
| 136 | 141 | const stream = &std.fs.File.openHandle(fd).inStream().stream; |
| 137 | 142 | stream.readNoEof(buf) catch return error.Unexpected; |
| 138 | 143 | } |