diff options
author | Vitaly _Vi Shukela <vi0oss@gmail.com> | 2020-09-10 23:04:35 +0300 |
---|---|---|
committer | Vitaly _Vi Shukela <vi0oss@gmail.com> | 2020-09-20 01:51:46 +0300 |
commit | 74cb1545f4d2249b6086c3f4aa242e43362759de (patch) | |
tree | d710ee4a9a9a40f69a3a03aa853ce4469ba448c4 /src/unistd.rs | |
parent | 2c2440521acb5942a5f937b8d3126577cf91106a (diff) | |
download | nix-74cb1545f4d2249b6086c3f4aa242e43362759de.zip |
Mark nix::unistd::fork as unsafe.
Fix tests. No change in documentation.
Resolves #1030.
Diffstat (limited to 'src/unistd.rs')
-rw-r--r-- | src/unistd.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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<ForkResult> { +pub unsafe fn fork() -> Result<ForkResult> { use self::ForkResult::*; - let res = unsafe { libc::fork() }; + let res = libc::fork(); Errno::result(res).map(|res| match res { 0 => Child, |