We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a51b70b commit 3ee3a78Copy full SHA for 3ee3a78
src/libstd/rand/os.rs
@@ -208,6 +208,8 @@ mod imp {
208
fn syscall(number: c_long, ...) -> c_long;
209
}
210
211
+ const NR_GETENTROPY: libc::c_long = 7;
212
+
213
impl OsRng {
214
/// Create a new `OsRng`.
215
pub fn new() -> io::Result<OsRng> {
@@ -231,7 +233,9 @@ mod imp {
231
233
232
234
// getentropy(2) permits a maximum buffer size of 256 bytes
235
for s in v.chunks_mut(256) {
- unsafe { ret = syscall(7, s.as_mut_ptr(), s.len()); }
236
+ unsafe {
237
+ ret = syscall(NR_GETENTROPY, s.as_mut_ptr(), s.len());
238
+ }
239
if ret == -1 {
240
panic!("unexpected getentropy error: {}", errno());
241
0 commit comments