diff --git a/src/header/sys_timerfd/mod.rs b/src/header/sys_timerfd/mod.rs index 0959d39..9a4a23e 100644 --- a/src/header/sys_timerfd/mod.rs +++ b/src/header/sys_timerfd/mod.rs @@ -86,7 +86,10 @@ pub extern "C" fn timerfd_create(clockid: clockid_t, flags: c_int) -> c_int { Ok(path) => path, Err(_) => return Err::(Errno(EINVAL)).or_minus_one_errno(), }; - let fd = Sys::open(CStr::borrow(&path), oflag, 0).or_minus_one_errno()?; + let fd = match Sys::open(CStr::borrow(&path), oflag, 0) { + Ok(fd) => fd, + Err(Errno(e)) => { return Err::(Errno(e)).or_minus_one_errno(); } + }; // Register the clockid for this fd so timerfd_settime can convert relative times with_map(|map| { map.insert(fd, clockid); }); @@ -107,7 +110,7 @@ pub unsafe extern "C" fn timerfd_settime(fd: c_int, flags: c_int, new: *const it return -1; } let spec = unsafe { &*new }; - let mut value = spec.it_value; + let mut value = spec.it_value.clone(); // Convert relative time to absolute if TFD_TIMER_ABSTIME is not set if flags & TFD_TIMER_ABSTIME == 0 {