summaryrefslogtreecommitdiff
path: root/src/unistd.rs
diff options
context:
space:
mode:
authorVitaly _Vi Shukela <vi0oss@gmail.com>2020-09-10 23:04:35 +0300
committerVitaly _Vi Shukela <vi0oss@gmail.com>2020-09-20 01:51:46 +0300
commit74cb1545f4d2249b6086c3f4aa242e43362759de (patch)
treed710ee4a9a9a40f69a3a03aa853ce4469ba448c4 /src/unistd.rs
parent2c2440521acb5942a5f937b8d3126577cf91106a (diff)
downloadnix-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.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,