Skip to content
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

Fix additional i8 to libc::c_char implicit conversions #40

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ use std::{io, net::IpAddr};

use crate::{AddAddress, AddressInfo, DeviceState, Interface};

pub(crate) const DEV_NET_TUN: *const i8 = b"/dev/net/tun\0".as_ptr() as *const i8;
pub(crate) const DEV_NET_TUN: *const libc::c_char =
b"/dev/net/tun\0".as_ptr() as *const libc::c_char;

// TODO: include Generic Receive Offset variant of Tun/Tap
//
Expand Down
4 changes: 2 additions & 2 deletions src/tap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ mod tests {
fn given_name() {
use std::ffi::CStr;

let chosen_name = unsafe { CStr::from_ptr(b"feth24\0".as_ptr() as *const i8) };
let chosen_name = unsafe { CStr::from_ptr(b"feth24\0".as_ptr() as *const libc::c_char) };

let iface = Interface::from_cstr(chosen_name).unwrap();
let tun = Tap::new_named(iface).unwrap();
Expand All @@ -186,7 +186,7 @@ mod tests {
fn given_name() {
use std::ffi::CStr;

let chosen_name = unsafe { CStr::from_ptr(b"tap24\0".as_ptr() as *const i8) };
let chosen_name = unsafe { CStr::from_ptr(b"tap24\0".as_ptr() as *const libc::c_char) };

let iface = Interface::from_cstr(chosen_name).unwrap();
let tap = Tap::new_named(iface).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/tun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ mod tests {
fn given_name() {
use std::ffi::CStr;

let chosen_name = unsafe { CStr::from_ptr(b"utun24\0".as_ptr() as *const i8) };
let chosen_name = unsafe { CStr::from_ptr(b"utun24\0".as_ptr() as *const libc::c_char) };

let iface = Interface::from_cstr(chosen_name).unwrap();
let tun = Tun::new_named(iface).unwrap();
Expand Down