mirror of https://github.com/dswd/vpncloud.git
Removing NULL-bytes from interface name
This commit is contained in:
parent
024442243b
commit
fa4547a309
|
@ -5,6 +5,7 @@ This project follows [semantic versioning](http://semver.org).
|
||||||
### Unreleased
|
### Unreleased
|
||||||
|
|
||||||
- [changed] Logging more verbosely
|
- [changed] Logging more verbosely
|
||||||
|
- [fixed] Removing NULL-bytes from interface name
|
||||||
|
|
||||||
### v0.4 (2015-12-22)
|
### v0.4 (2015-12-22)
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,12 @@ impl Device {
|
||||||
Type::Tap => unsafe { setup_tap_device(fd.as_raw_fd(), ifname_c.as_mut_ptr()) }
|
Type::Tap => unsafe { setup_tap_device(fd.as_raw_fd(), ifname_c.as_mut_ptr()) }
|
||||||
};
|
};
|
||||||
match res {
|
match res {
|
||||||
0 => Ok(Device{fd: fd, ifname: String::from_utf8(ifname_c).unwrap()}),
|
0 => {
|
||||||
|
while ifname_c.last() == Some(&0) {
|
||||||
|
ifname_c.pop();
|
||||||
|
}
|
||||||
|
Ok(Device{fd: fd, ifname: String::from_utf8(ifname_c).unwrap()})
|
||||||
|
},
|
||||||
_ => Err(IoError::last_os_error())
|
_ => Err(IoError::last_os_error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue