Skip to content

Commit 65ef265

Browse files
committed
Call libc::sigaction() only on Android
1 parent e3e5ae9 commit 65ef265

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

library/std/src/sys/unix/process/process_unix.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,20 @@ impl Command {
333333
let mut set = MaybeUninit::<libc::sigset_t>::uninit();
334334
cvt(sigemptyset(set.as_mut_ptr()))?;
335335
cvt(libc::pthread_sigmask(libc::SIG_SETMASK, set.as_ptr(), ptr::null_mut()))?;
336-
let mut action: libc::sigaction = mem::zeroed();
337-
action.sa_sigaction = libc::SIG_DFL;
338-
cvt(libc::sigaction(libc::SIGPIPE, &action, ptr::null_mut()))?;
336+
337+
#[cfg(target_os = "android")] // see issue #88585
338+
{
339+
let mut action: libc::sigaction = mem::zeroed();
340+
action.sa_sigaction = libc::SIG_DFL;
341+
cvt(libc::sigaction(libc::SIGPIPE, &action, ptr::null_mut()))?;
342+
}
343+
#[cfg(not(target_os = "android"))]
344+
{
345+
let ret = sys::signal(libc::SIGPIPE, libc::SIG_DFL);
346+
if ret == libc::SIG_ERR {
347+
return Err(io::Error::last_os_error());
348+
}
349+
}
339350
}
340351

341352
for callback in self.get_closures().iter_mut() {

0 commit comments

Comments
 (0)