Skip to content

Commit 8d5a85c

Browse files
authoredNov 30, 2023
fix: FreeBSD kld_load() (#35)
1 parent d0caf49 commit 8d5a85c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/bsd/ifconfig.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
os::fd::AsRawFd,
44
};
55

6-
use libc::kld_load;
6+
use libc::{c_char, kld_load};
77
use nix::{ioctl_readwrite, ioctl_write_ptr, sys::socket::AddressFamily};
88

99
use super::{
@@ -49,7 +49,8 @@ impl IfReq {
4949
let mod_name = format!("if_{if_name}");
5050
unsafe {
5151
// Ignore the return value for the time being.
52-
kld_load(mod_name.as_ptr());
52+
// Do the cast because `c_char` differs across platforms.
53+
kld_load(mod_name.as_ptr() as *const c_char);
5354
}
5455

5556
Self {

0 commit comments

Comments
 (0)