Skip to content

fix: use CString for interface name #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 30, 2023
Merged

fix: use CString for interface name #35

merged 4 commits into from
Nov 30, 2023

Conversation

dzania
Copy link
Contributor

@dzania dzania commented Nov 30, 2023

When building for freebsd code won't compile due to

    Checking defguard_wireguard_rs v0.3.0 (/home/dzania/teonite/linux_route/wireguard-rs)
error[E0308]: mismatched types
    --> src/bsd/ifconfig.rs:52:22
     |
52   |             kld_load(mod_name.as_ptr());
     |             -------- ^^^^^^^^^^^^^^^^^ expected `*const i8`, found `*const u8`
     |             |
     |             arguments to this function are incorrect
     |
     = note: expected raw pointer `*const i8`
                found raw pointer `*const u8`
note: function defined here
    --> /home/dzania/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.150/src/unix/bsd/freebsdlike/freebsd/mod.rs:5539:12
     |
5539 |     pub fn kld_load(name: *const ::c_char) -> ::c_int;

Fix for this is using CString from std::ffi

@dzania dzania requested a review from moubctez November 30, 2023 11:20
@moubctez moubctez merged commit 8d5a85c into main Nov 30, 2023
@moubctez moubctez deleted the fix_build_freebsd branch November 30, 2023 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants