mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 19:36:47 +00:00
修复drop fd时,文件描述符引用不为0的问题 (#382)
This commit is contained in:
parent
de71ec259c
commit
71474bc682
@ -503,11 +503,7 @@ impl FileDescriptorVec {
|
|||||||
return Err(SystemError::EBADF);
|
return Err(SystemError::EBADF);
|
||||||
}
|
}
|
||||||
|
|
||||||
let f = self.get_file_by_fd(fd);
|
self.get_file_by_fd(fd).ok_or(SystemError::EBADF)?;
|
||||||
if f.is_none() {
|
|
||||||
// 如果文件描述符不存在,报错
|
|
||||||
return Err(SystemError::EBADF);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 把文件描述符数组对应位置设置为空
|
// 把文件描述符数组对应位置设置为空
|
||||||
let file = self.fds[fd as usize].take().unwrap();
|
let file = self.fds[fd as usize].take().unwrap();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user