From 74cb1545f4d2249b6086c3f4aa242e43362759de Mon Sep 17 00:00:00 2001 From: Vitaly _Vi Shukela Date: Thu, 10 Sep 2020 23:04:35 +0300 Subject: Mark nix::unistd::fork as unsafe. Fix tests. No change in documentation. Resolves #1030. --- src/unistd.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/unistd.rs b/src/unistd.rs index 4a7903a3..04031e37 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -200,7 +200,7 @@ impl ForkResult { /// ```no_run /// use nix::unistd::{fork, ForkResult}; /// -/// match fork() { +/// match unsafe{fork()} { /// Ok(ForkResult::Parent { child, .. }) => { /// println!("Continuing execution in parent process, new child has pid: {}", child); /// } @@ -230,9 +230,9 @@ impl ForkResult { /// /// [async-signal-safe]: http://man7.org/linux/man-pages/man7/signal-safety.7.html #[inline] -pub fn fork() -> Result { +pub unsafe fn fork() -> Result { use self::ForkResult::*; - let res = unsafe { libc::fork() }; + let res = libc::fork(); Errno::result(res).map(|res| match res { 0 => Child, -- cgit v1.2.3