diff --git a/libbpf-rs/src/util.rs b/libbpf-rs/src/util.rs index 4a1b8ea2..e8fdddf4 100644 --- a/libbpf-rs/src/util.rs +++ b/libbpf-rs/src/util.rs @@ -120,7 +120,7 @@ pub fn create_bpf_entity_checked_opt *mut B>( // SAFETY: We checked if the pointer was non null before. NonNull::new_unchecked(ptr) })), - err => Err(Error::from_raw_os_error(err as i32)), + err => Err(Error::from_raw_os_error(-err as i32)), } }