mirror of git://git.musl-libc.org/musl
restore property that fstat(AT_FDCWD) fails with EBADF
AT_FDCWD is not a valid file descriptor, so POSIX requires fstat to fail with EBADF. if passed to fstatat, the call would spuriously succeed and return results for the working directory.
This commit is contained in:
parent
fa7d4218c7
commit
eeff60608c
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
int fstat(int fd, struct stat *st)
|
int fstat(int fd, struct stat *st)
|
||||||
{
|
{
|
||||||
|
if (fd<0) return __syscall_ret(-EBADF);
|
||||||
return fstatat(fd, "", st, AT_EMPTY_PATH);
|
return fstatat(fd, "", st, AT_EMPTY_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue