vmm: config: Don't close reserved FDs from NetConfig::drop()
Fixes: #5203 Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
4f945743cb
commit
0110fb4edc
1 changed files with 5 additions and 0 deletions
|
|
@ -1154,6 +1154,11 @@ impl Drop for NetConfig {
|
|||
fn drop(&mut self) {
|
||||
if let Some(mut fds) = self.fds.take() {
|
||||
for fd in fds.drain(..) {
|
||||
// Skip reserved FDs
|
||||
if fd <= 2 {
|
||||
continue;
|
||||
}
|
||||
|
||||
// SAFETY: Safe as the fd was given to the config by the API
|
||||
unsafe { libc::close(fd) };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue