mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-01 02:55:45 +00:00
virtio-devices: vhost-user: fs: Don't close file descriptor
The file descriptor provided to fs_slave_map() and fs_slave_io() is passed as a AsRawFd trait, meaning the caller owns it. For that reason, there's no need for these functions to close the file descriptor as it will be closed later on anyway. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
bbf7fd5372
commit
bc90fe4c71
@ -108,11 +108,6 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
if ret == libc::MAP_FAILED {
|
if ret == libc::MAP_FAILED {
|
||||||
return Err(io::Error::last_os_error());
|
return Err(io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret = unsafe { libc::close(fd.as_raw_fd()) };
|
|
||||||
if ret == -1 {
|
|
||||||
return Err(io::Error::last_os_error());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(0)
|
Ok(0)
|
||||||
@ -271,11 +266,6 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret = unsafe { libc::close(fd.as_raw_fd()) };
|
|
||||||
if ret == -1 {
|
|
||||||
return Err(io::Error::last_os_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(done)
|
Ok(done)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user