diff options
author | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-10-01 21:22:18 +0200 |
---|---|---|
committer | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-10-01 21:22:18 +0200 |
commit | 65ef265c121c90e33dd9dd2dc3b919cf37209b71 (patch) | |
tree | cc11115b5470763bccb293ca8c02417b5f4aaef5 /library/std/src/sys/unix/process/process_unix.rs | |
parent | e3e5ae91d07f7d4256acac7abac6a204b6abc491 (diff) | |
download | rust-65ef265c121c90e33dd9dd2dc3b919cf37209b71.tar.gz |
Call `libc::sigaction()` only on Android
Diffstat (limited to 'library/std/src/sys/unix/process/process_unix.rs')
-rw-r--r-- | library/std/src/sys/unix/process/process_unix.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs index caef9914ac2..5837c1553ec 100644 --- a/library/std/src/sys/unix/process/process_unix.rs +++ b/library/std/src/sys/unix/process/process_unix.rs @@ -333,9 +333,20 @@ impl Command { 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()))?; - let mut action: libc::sigaction = mem::zeroed(); - action.sa_sigaction = libc::SIG_DFL; - cvt(libc::sigaction(libc::SIGPIPE, &action, ptr::null_mut()))?; + + #[cfg(target_os = "android")] // see issue #88585 + { + let mut action: libc::sigaction = mem::zeroed(); + action.sa_sigaction = libc::SIG_DFL; + cvt(libc::sigaction(libc::SIGPIPE, &action, ptr::null_mut()))?; + } + #[cfg(not(target_os = "android"))] + { + let ret = sys::signal(libc::SIGPIPE, libc::SIG_DFL); + if ret == libc::SIG_ERR { + return Err(io::Error::last_os_error()); + } + } } for callback in self.get_closures().iter_mut() { |