summaryrefslogtreecommitdiff
path: root/test/test_unistd.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-10-03 13:36:12 +0000
committerGitHub <noreply@github.com>2020-10-03 13:36:12 +0000
commit8e3789da81212269f5a871801beb5e6fc323111b (patch)
treea1bea6df5a1fb17ebdcfd67c5c6772efe437f5ad /test/test_unistd.rs
parentfe0aa236cf96969b5d80c5c6504601c6e746edcf (diff)
parent42172a6764c96ed5e420debcb3ed00c6dca5fb41 (diff)
downloadnix-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/test_unistd.rs')
-rw-r--r--test/test_unistd.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/test_unistd.rs b/test/test_unistd.rs
index 0b2a810a..c7a75fbe 100644
--- a/test/test_unistd.rs
+++ b/test/test_unistd.rs
@@ -32,7 +32,7 @@ fn test_fork_and_waitpid() {
let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test");
// Safe: Child only calls `_exit`, which is signal-safe
- match fork().expect("Error: Fork Failed") {
+ match unsafe{fork()}.expect("Error: Fork Failed") {
Child => unsafe { _exit(0) },
Parent { child } => {
// assert that child was created and pid > 0
@@ -60,7 +60,7 @@ fn test_wait() {
let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test");
// Safe: Child only calls `_exit`, which is signal-safe
- match fork().expect("Error: Fork Failed") {
+ match unsafe{fork()}.expect("Error: Fork Failed") {
Child => unsafe { _exit(0) },
Parent { child } => {
let wait_status = wait();
@@ -302,7 +302,7 @@ macro_rules! execve_test_factory(
// Safe: Child calls `exit`, `dup`, `close` and the provided `exec*` family function.
// NOTE: Technically, this makes the macro unsafe to use because you could pass anything.
// The tests make sure not to do that, though.
- match fork().unwrap() {
+ match unsafe{fork()}.unwrap() {
Child => {
// Make `writer` be the stdout of the new process.
dup2(writer, 1).unwrap();