浏览代码

fix missing flags arg to fstatat syscall in fstat fallback path

this code path is used only on archs without the plain, non-at
syscalls, and only when the fstat syscall fails with EBADF on a valid
file descriptor. this in turn can happen only for O_PATH file
descriptors, and may not happen at all on the newer kernels needed for
supporting such archs.

with the flags argument omitted, spurious fstat failures may happen
when the argument register happens to have the AT_SYMLINK_NOFOLLOW bit
set.
Rich Felker 10 年之前
父节点
当前提交
dc9c40a609
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/stat/fstat.c

+ 1 - 1
src/stat/fstat.c

@@ -17,7 +17,7 @@ int fstat(int fd, struct stat *st)
 #ifdef SYS_stat
 	return syscall(SYS_stat, buf, st);
 #else
-	return syscall(SYS_fstatat, AT_FDCWD, buf, st);
+	return syscall(SYS_fstatat, AT_FDCWD, buf, st, 0);
 #endif
 }