diff options
| author | bors <bors@rust-lang.org> | 2022-04-17 22:54:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-17 22:54:55 +0000 |
| commit | e27d9df4319bd822e64f620676543d31e9c7ae2c (patch) | |
| tree | a4047a4be0f46c929032000d5a77a61fde0fa7b4 /library/std/src/sys/unix/process/process_unix.rs | |
| parent | ec77f252434a532fdb5699ae4f21a3072d211edd (diff) | |
| parent | e6aafbc70781bd346c6363a166641baa4f224a14 (diff) | |
| download | rust-e27d9df4319bd822e64f620676543d31e9c7ae2c.tar.gz rust-e27d9df4319bd822e64f620676543d31e9c7ae2c.zip | |
Auto merge of #93530 - anonion0:pthread_sigmask_fix, r=JohnTitor
fix error handling for pthread_sigmask(3) Errors from `pthread_sigmask(3)` were handled using `cvt()`, which expects a return value of `-1` on error and uses `errno`. However, `pthread_sigmask(3)` returns `0` on success and an error number otherwise. Fix it by replacing `cvt()` with `cvt_nz()`.
Diffstat (limited to 'library/std/src/sys/unix/process/process_unix.rs')
| -rw-r--r-- | library/std/src/sys/unix/process/process_unix.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs index 3d305cd7310..d48faaa88fb 100644 --- a/library/std/src/sys/unix/process/process_unix.rs +++ b/library/std/src/sys/unix/process/process_unix.rs @@ -328,6 +328,7 @@ impl Command { #[cfg(not(target_os = "emscripten"))] { use crate::mem::MaybeUninit; + use crate::sys::cvt_nz; // Reset signal handling so the child process starts in a // standardized state. libstd ignores SIGPIPE, and signal-handling // libraries often set a mask. Child processes inherit ignored @@ -337,7 +338,7 @@ impl Command { // we're about to run. let mut set = MaybeUninit::<libc::sigset_t>::uninit(); cvt(sigemptyset(set.as_mut_ptr()))?; - cvt(libc::pthread_sigmask(libc::SIG_SETMASK, set.as_ptr(), ptr::null_mut()))?; + cvt_nz(libc::pthread_sigmask(libc::SIG_SETMASK, set.as_ptr(), ptr::null_mut()))?; #[cfg(target_os = "android")] // see issue #88585 { |
