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:
Sebastien Boeuf 2022-03-24 12:02:06 +01:00 committed by Rob Bradford
parent bbf7fd5372
commit bc90fe4c71

View File

@ -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)
} }
} }