diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-01-11 15:55:52 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-01-11 15:55:52 +0000 |
commit | 5f321db0196669b60f1ef4bcaf44d28238565077 (patch) | |
tree | 3c32a0ef2be62475c420a21f504cfd640cc8de15 | |
parent | 2478f0fa44b548bfe3a120f8a4fef61e73cf7ba4 (diff) | |
parent | 992c293e8822b3ee00b251633345459822ba4111 (diff) | |
download | nix-5f321db0196669b60f1ef4bcaf44d28238565077.zip |
Merge #836
836: Remove return value from `pause` r=asomers a=Thomasdezeeuw
Follow up on https://github.com/nix-rust/nix/pull/829, since that repo is now unknown to GitHub.
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | src/unistd.rs | 10 | ||||
-rw-r--r-- | test/sys/test_wait.rs | 5 |
3 files changed, 10 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index aece03d7..3eb1cf9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,7 +94,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Both `ip_mreq` and `ipv6_mreq` have been replaced with `IpMembershipRequest` and `Ipv6MembershipRequest`. ([#814](https://github.com/nix-rust/nix/pull/814)) - +- Removed return type from `pause`. + ([#829](https://github.com/nix-rust/nix/pull/829)) ### Fixed - Fix compilation and tests for OpenBSD targets diff --git a/src/unistd.rs b/src/unistd.rs index 56390d90..0f47a7fc 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -1316,14 +1316,12 @@ pub fn initgroups(user: &CStr, group: Gid) -> Result<()> { Errno::result(res).map(|_| ()) } -/// Suspend the thread until a signal is received +/// Suspend the thread until a signal is received. /// -/// See also [pause(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pause.html) +/// See also [pause(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pause.html). #[inline] -pub fn pause() -> Result<()> { - let res = unsafe { libc::pause() }; - - Errno::result(res).map(drop) +pub fn pause() { + unsafe { libc::pause() }; } /// Suspend execution for an interval of time diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs index 9992607c..2f68e7c4 100644 --- a/test/sys/test_wait.rs +++ b/test/sys/test_wait.rs @@ -12,7 +12,10 @@ fn test_wait_signal() { // Safe: The child only calls `pause` and/or `_exit`, which are async-signal-safe. match fork().expect("Error: Fork Failed") { - Child => pause().unwrap_or_else(|_| unsafe { _exit(123) }), + Child => { + pause(); + unsafe { _exit(123) } + }, Parent { child } => { kill(child, Some(SIGKILL)).expect("Error: Kill Failed"); assert_eq!(waitpid(child, None), Ok(WaitStatus::Signaled(child, SIGKILL, false))); |