Use pointer::write_bytes for android sigemptyset

This commit is contained in:
Josh Stone 2019-06-26 16:27:54 -07:00
parent 3ba1f39fe7
commit b533aff927
2 changed files with 3 additions and 5 deletions

View File

@ -437,7 +437,7 @@ mod tests {
#[cfg(target_os = "android")]
unsafe fn sigemptyset(set: *mut libc::sigset_t) -> libc::c_int {
libc::memset(set as *mut _, 0, mem::size_of::<libc::sigset_t>());
set.write_bytes(0u8, 1);
return 0;
}

View File

@ -202,7 +202,7 @@ impl Command {
// emscripten has no signal support.
#[cfg(not(any(target_os = "emscripten")))]
{
use crate::mem::{self, MaybeUninit};
use crate::mem::MaybeUninit;
// 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
@ -215,9 +215,7 @@ impl Command {
// Implementing sigemptyset allow us to support older Android
// versions. See the comment about Android and sig* functions in
// process_common.rs
libc::memset(set.as_mut_ptr() as *mut _,
0,
mem::size_of::<libc::sigset_t>());
set.as_mut_ptr().write_bytes(0u8, 1);
} else {
cvt(libc::sigemptyset(set.as_mut_ptr()))?;
}