summaryrefslogtreecommitdiff
path: root/src/ucontext.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ucontext.rs')
-rw-r--r--src/ucontext.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ucontext.rs b/src/ucontext.rs
index 5e10e7d1..1bcfdd9b 100644
--- a/src/ucontext.rs
+++ b/src/ucontext.rs
@@ -14,11 +14,11 @@ pub struct UContext {
impl UContext {
#[cfg(not(target_env = "musl"))]
pub fn get() -> Result<UContext> {
- let mut context: libc::ucontext_t = unsafe { mem::uninitialized() };
- let res = unsafe {
- libc::getcontext(&mut context as *mut libc::ucontext_t)
- };
- Errno::result(res).map(|_| UContext { context: context })
+ let mut context = mem::MaybeUninit::<libc::ucontext_t>::uninit();
+ let res = unsafe { libc::getcontext(context.as_mut_ptr()) };
+ Errno::result(res).map(|_| unsafe {
+ UContext { context: context.assume_init()}
+ })
}
#[cfg(not(target_env = "musl"))]