Skip to content

Commit

Permalink
Fix additional i8 to libc::c_char implicit conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
nathaniel-bennett committed Nov 4, 2024
1 parent d09fd65 commit d46ec15
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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

0 comments on commit d46ec15

Please sign in to comment.