mirror of https://github.com/dswd/vpncloud.git
Compare commits
No commits in common. "2d5565277e5f81a894ef7831197b2ceac4634d95" and "176e1956e6aa7a336269ba9830d789180b53f5a1" have entirely different histories.
2d5565277e
...
176e1956e6
|
@ -41,6 +41,7 @@ jobs:
|
||||||
- name: Run cargo-tarpaulin
|
- name: Run cargo-tarpaulin
|
||||||
uses: actions-rs/tarpaulin@v0.1
|
uses: actions-rs/tarpaulin@v0.1
|
||||||
with:
|
with:
|
||||||
|
version: '0.9.0'
|
||||||
args: '-o Html -- --test-threads=1'
|
args: '-o Html -- --test-threads=1'
|
||||||
- name: Archive code coverage results
|
- name: Archive code coverage results
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@ use libc::{c_short, c_ulong, ioctl, IFF_NO_PI, IFF_TAP, IFF_TUN, IF_NAMESIZE};
|
||||||
use std::{
|
use std::{
|
||||||
collections::VecDeque,
|
collections::VecDeque,
|
||||||
fmt, fs,
|
fmt, fs,
|
||||||
io::{self, Cursor, Error as IoError, ErrorKind, Read, Write},
|
io::{self, Error as IoError, ErrorKind, Read, Write},
|
||||||
os::unix::io::{AsRawFd, RawFd},
|
os::unix::io::{AsRawFd, RawFd},
|
||||||
str,
|
str,
|
||||||
str::FromStr
|
str::FromStr
|
||||||
|
@ -150,10 +150,8 @@ impl TunTapDevice {
|
||||||
let res = unsafe { ioctl(fd.as_raw_fd(), TUNSETIFF, &mut ifreq) };
|
let res = unsafe { ioctl(fd.as_raw_fd(), TUNSETIFF, &mut ifreq) };
|
||||||
match res {
|
match res {
|
||||||
0 => {
|
0 => {
|
||||||
let mut ifname = String::with_capacity(32);
|
let nul_range_end = ifreq.ifr_name.iter().position(|&c| c == b'\0').unwrap_or(ifreq.ifr_name.len());
|
||||||
let mut cursor = Cursor::new(ifreq.ifr_name);
|
let ifname = unsafe { str::from_utf8_unchecked(&ifreq.ifr_name[0..nul_range_end]) }.to_string();
|
||||||
cursor.read_to_string(&mut ifname)?;
|
|
||||||
ifname = ifname.trim_end_matches('\0').to_owned();
|
|
||||||
Ok(Self { fd, ifname, type_ })
|
Ok(Self { fd, ifname, type_ })
|
||||||
}
|
}
|
||||||
_ => Err(IoError::last_os_error())
|
_ => Err(IoError::last_os_error())
|
||||||
|
|
Loading…
Reference in New Issue