diff options
| author | Ralf Jung <post@ralfj.de> | 2020-10-31 16:16:54 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-10-31 16:26:06 +0100 |
| commit | 9f630af93077b276f78701dcd2307d19dccf0e14 (patch) | |
| tree | 38c13281a2a31c39477048784f303ec2bccc9c00 | |
| parent | ed96321e7e32d3c047f204445b849c75f3c63e28 (diff) | |
| download | rust-9f630af93077b276f78701dcd2307d19dccf0e14.tar.gz rust-9f630af93077b276f78701dcd2307d19dccf0e14.zip | |
fix aliasing issue in unix sleep function
| -rw-r--r-- | library/std/src/sys/unix/thread.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index fdf114d6df6..f1ab302d30e 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -178,7 +178,8 @@ impl Thread { tv_nsec: nsecs, }; secs -= ts.tv_sec as u64; - if libc::nanosleep(&ts, &mut ts) == -1 { + let ts_ptr = &mut ts as *mut _; + if libc::nanosleep(ts_ptr, ts_ptr) == -1 { assert_eq!(os::errno(), libc::EINTR); secs += ts.tv_sec as u64; nsecs = ts.tv_nsec; |
