From 8d5a85c5aae71de125e828ca182f2baada25f513 Mon Sep 17 00:00:00 2001 From: Artur Kantorczyk Date: Thu, 30 Nov 2023 12:52:02 +0100 Subject: [PATCH] fix: FreeBSD kld_load() (#35) --- src/bsd/ifconfig.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bsd/ifconfig.rs b/src/bsd/ifconfig.rs index 025fc49..9dc86e5 100644 --- a/src/bsd/ifconfig.rs +++ b/src/bsd/ifconfig.rs @@ -3,7 +3,7 @@ use std::{ os::fd::AsRawFd, }; -use libc::kld_load; +use libc::{c_char, kld_load}; use nix::{ioctl_readwrite, ioctl_write_ptr, sys::socket::AddressFamily}; use super::{ @@ -49,7 +49,8 @@ impl IfReq { let mod_name = format!("if_{if_name}"); unsafe { // Ignore the return value for the time being. - kld_load(mod_name.as_ptr()); + // Do the cast because `c_char` differs across platforms. + kld_load(mod_name.as_ptr() as *const c_char); } Self {