filetable::close print message if fd >= NOFILE

上级 41530e6b
......@@ -42,6 +42,10 @@ public:
// XXX(sbw) if f->ref_ > 1 the kernel will not actually close
// the file when this function returns (i.e. sys_close can return
// while the file/pipe/socket is still open).
if (fd >= NOFILE) {
cprintf("filetable::close: bad fd %u\n", fd);
return;
}
file* f = ofile_[fd].exchange(nullptr);
if (f != nullptr)
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论