Skip to content

Commit

Permalink
Use pointer::write_bytes for android sigemptyset
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Jun 26, 2019
1 parent 3ba1f39 commit b533aff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libstd/sys/unix/process/process_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 2 additions & 4 deletions src/libstd/sys/unix/process/process_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()))?;
}
Expand Down

0 comments on commit b533aff

Please sign in to comment.