mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 17:15:43 +00:00
fix(tunnel): silence macOS BPF unsafe warnings
Make macOS BPF ioctl wrappers explicit about unsafe calls. - Wrap libc ioctl calls in unsafe blocks - Keep the existing error handling unchanged
This commit is contained in:
@@ -232,7 +232,7 @@ fn iowr<T>(group: u8, num: u8) -> libc::c_ulong {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn ioctl_ptr<T>(fd: libc::c_int, req: libc::c_ulong, arg: *mut T) -> io::Result<()> {
|
unsafe fn ioctl_ptr<T>(fd: libc::c_int, req: libc::c_ulong, arg: *mut T) -> io::Result<()> {
|
||||||
let ret = libc::ioctl(fd, req, arg);
|
let ret = unsafe { libc::ioctl(fd, req, arg) };
|
||||||
if ret < 0 {
|
if ret < 0 {
|
||||||
return Err(io::Error::last_os_error());
|
return Err(io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
@@ -240,7 +240,7 @@ unsafe fn ioctl_ptr<T>(fd: libc::c_int, req: libc::c_ulong, arg: *mut T) -> io::
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn ioctl_void(fd: libc::c_int, req: libc::c_ulong) -> io::Result<()> {
|
unsafe fn ioctl_void(fd: libc::c_int, req: libc::c_ulong) -> io::Result<()> {
|
||||||
let ret = libc::ioctl(fd, req);
|
let ret = unsafe { libc::ioctl(fd, req) };
|
||||||
if ret < 0 {
|
if ret < 0 {
|
||||||
return Err(io::Error::last_os_error());
|
return Err(io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user