Skip to content

Commit

Permalink
fix: pass negative error code to Error::from_raw_os_error
Browse files Browse the repository at this point in the history
  • Loading branch information
honsunrise authored and danielocfb committed Mar 6, 2024
1 parent 8a0acb6 commit 7cd094e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libbpf-rs/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn create_bpf_entity_checked_opt<B: 'static, F: FnOnce() -> *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)),
}
}

Expand Down

0 comments on commit 7cd094e

Please sign in to comment.