Tweak sys_openat

上级 dd3aba4e
...@@ -275,9 +275,8 @@ sys_openat(int dirfd, const char *path, int omode) ...@@ -275,9 +275,8 @@ sys_openat(int dirfd, const char *path, int omode)
if (dirfd == AT_FDCWD) { if (dirfd == AT_FDCWD) {
cwd = myproc()->cwd; cwd = myproc()->cwd;
} else if (dirfd < 0 || dirfd >= NOFILE) {
return -1;
} else { } else {
// XXX(sbw) do we need the sref while we touch fdir->ip?
sref<file> fdir; sref<file> fdir;
if (!getfile(dirfd, &fdir) || fdir->type != file::FD_INODE) if (!getfile(dirfd, &fdir) || fdir->type != file::FD_INODE)
return -1; return -1;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论