Skip to content

Commit b533aff

Browse files
committed
Use pointer::write_bytes for android sigemptyset
1 parent 3ba1f39 commit b533aff

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/libstd/sys/unix/process/process_common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ mod tests {
437437

438438
#[cfg(target_os = "android")]
439439
unsafe fn sigemptyset(set: *mut libc::sigset_t) -> libc::c_int {
440-
libc::memset(set as *mut _, 0, mem::size_of::<libc::sigset_t>());
440+
set.write_bytes(0u8, 1);
441441
return 0;
442442
}
443443

src/libstd/sys/unix/process/process_unix.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl Command {
202202
// emscripten has no signal support.
203203
#[cfg(not(any(target_os = "emscripten")))]
204204
{
205-
use crate::mem::{self, MaybeUninit};
205+
use crate::mem::MaybeUninit;
206206
// Reset signal handling so the child process starts in a
207207
// standardized state. libstd ignores SIGPIPE, and signal-handling
208208
// libraries often set a mask. Child processes inherit ignored
@@ -215,9 +215,7 @@ impl Command {
215215
// Implementing sigemptyset allow us to support older Android
216216
// versions. See the comment about Android and sig* functions in
217217
// process_common.rs
218-
libc::memset(set.as_mut_ptr() as *mut _,
219-
0,
220-
mem::size_of::<libc::sigset_t>());
218+
set.as_mut_ptr().write_bytes(0u8, 1);
221219
} else {
222220
cvt(libc::sigemptyset(set.as_mut_ptr()))?;
223221
}

0 commit comments

Comments
 (0)