diff options
author | Rich Felker <dalias@aerifal.cx> | 2019-07-18 19:41:52 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-07-18 19:47:46 -0400 |
commit | eeff60608c7aa65806c7c9f0ebddcf2520684ffa (patch) | |
tree | f8632785fb8ebefa892f15fe1e05b02091de6b07 | |
parent | fa7d4218c7038cb4bd29cbdf693306118b324030 (diff) | |
download | musl-eeff60608c7aa65806c7c9f0ebddcf2520684ffa.tar.gz musl-eeff60608c7aa65806c7c9f0ebddcf2520684ffa.tar.bz2 musl-eeff60608c7aa65806c7c9f0ebddcf2520684ffa.tar.xz musl-eeff60608c7aa65806c7c9f0ebddcf2520684ffa.zip |
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.
-rw-r--r-- | src/stat/fstat.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/stat/fstat.c b/src/stat/fstat.c index d2a828f3..07f9a5de 100644 --- a/src/stat/fstat.c +++ b/src/stat/fstat.c @@ -6,6 +6,7 @@ int fstat(int fd, struct stat *st) { + if (fd<0) return __syscall_ret(-EBADF); return fstatat(fd, "", st, AT_EMPTY_PATH); } |