diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-03 13:36:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-03 13:36:12 +0000 |
commit | 8e3789da81212269f5a871801beb5e6fc323111b (patch) | |
tree | a1bea6df5a1fb17ebdcfd67c5c6772efe437f5ad /test/sys/test_wait.rs | |
parent | fe0aa236cf96969b5d80c5c6504601c6e746edcf (diff) | |
parent | 42172a6764c96ed5e420debcb3ed00c6dca5fb41 (diff) | |
download | nix-8e3789da81212269f5a871801beb5e6fc323111b.zip |
Merge #1293
1293: Mark nix::unistd::fork as unsafe. r=asomers a=vi
Fix tests. No change in documentation.
Resolves #1030.
Don't forget to bump major version number to `0.19`.
Co-authored-by: Vitaly _Vi Shukela <vi0oss@gmail.com>
Diffstat (limited to 'test/sys/test_wait.rs')
-rw-r--r-- | test/sys/test_wait.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs index 53b7c84a..d1056250 100644 --- a/test/sys/test_wait.rs +++ b/test/sys/test_wait.rs @@ -11,7 +11,7 @@ fn test_wait_signal() { let _ = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); // Safe: The child only calls `pause` and/or `_exit`, which are async-signal-safe. - match fork().expect("Error: Fork Failed") { + match unsafe{fork()}.expect("Error: Fork Failed") { Child => { pause(); unsafe { _exit(123) } @@ -28,7 +28,7 @@ fn test_wait_exit() { let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); // Safe: Child only calls `_exit`, which is async-signal-safe. - match fork().expect("Error: Fork Failed") { + match unsafe{fork()}.expect("Error: Fork Failed") { Child => unsafe { _exit(12); }, Parent { child } => { assert_eq!(waitpid(child, None), Ok(WaitStatus::Exited(child, 12))); @@ -48,7 +48,7 @@ fn test_waitstatus_from_raw() { fn test_waitstatus_pid() { let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); - match fork().unwrap() { + match unsafe{fork()}.unwrap() { Child => unsafe { _exit(0) }, Parent { child } => { let status = waitpid(child, None).unwrap(); @@ -98,7 +98,7 @@ mod ptrace { require_capability!(CAP_SYS_PTRACE); let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); - match fork().expect("Error: Fork Failed") { + match unsafe{fork()}.expect("Error: Fork Failed") { Child => ptrace_child(), Parent { child } => ptrace_parent(child), } |