mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-01 02:55:45 +00:00
virtio-device: add a safety comment for a dup(2) call
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
9b3cab8c72
commit
32af6f9723
@ -488,6 +488,7 @@ impl Net {
|
|||||||
|
|
||||||
for fd in fds.iter() {
|
for fd in fds.iter() {
|
||||||
// Duplicate so that it can survive reboots
|
// Duplicate so that it can survive reboots
|
||||||
|
// SAFETY: FFI call to dup. Trivially safe.
|
||||||
let fd = unsafe { libc::dup(*fd) };
|
let fd = unsafe { libc::dup(*fd) };
|
||||||
if fd < 0 {
|
if fd < 0 {
|
||||||
return Err(Error::DuplicateTapFd(std::io::Error::last_os_error()));
|
return Err(Error::DuplicateTapFd(std::io::Error::last_os_error()));
|
||||||
|
Loading…
Reference in New Issue
Block a user