Skip to content

Commit

Permalink
fix aliasing issue in unix sleep function
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 31, 2020
1 parent ed96321 commit 9f630af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/std/src/sys/unix/thread.rs
Expand Up @@ -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;
Expand Down

0 comments on commit 9f630af

Please sign in to comment.