summaryrefslogtreecommitdiff
path: root/src
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 /src
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 'src')
-rw-r--r--src/unistd.rs6
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,