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 6dd0db7 commit 8ab3708Copy full SHA for 8ab3708
src/os.rs
@@ -357,9 +357,10 @@ mod imp {
357
if dest.len() == 0 { return Ok(()); }
358
trace!("OsRng: reading {} bytes from random device", dest.len());
359
360
- // Since we have an instance of Self, we can assume that our memory was
361
- // set with a valid object.
362
- let mutex = unsafe{ READ_RNG_FILE.as_ref().unwrap() };
+ // We expect this function only to be used after `open_dev_random` was
+ // succesful. Therefore we can assume that our memory was set with a
+ // valid object.
363
+ let mutex = unsafe { READ_RNG_FILE.as_ref().unwrap() };
364
let mut guard = mutex.lock().unwrap();
365
let file = (*guard).as_mut().unwrap();
366
// Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`.
0 commit comments