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 /src | |
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 'src')
-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, |