io: Return EBAFD for negative file descriptor on fstat (BZ #27559)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 11 Mar 2021 11:21:06 +0000 (08:21 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 11 Mar 2021 13:51:55 +0000 (10:51 -0300)
commit94caafa040e4b4289c968cd70d53041b1463ac4d
tree3cf4b0cecd7a112f32fb6a9756f0203eac635cd7
parente91f44089c3203f647d6feadb958ff5f388427bd
io: Return EBAFD for negative file descriptor on fstat (BZ #27559)

Now that fstat is implemented on top fstatat we need to handle negative
inputs.  The implementation now rejects AT_FDCWD, which would otherwise
be accepted by the kernel.

Checked on x86_64-linux-gnu and on i686-linux-gnu.
io/Makefile
io/fstat.c
io/fstat64.c
io/tst-stat-lfs.c [new file with mode: 0644]
io/tst-stat.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/fstat.c
sysdeps/unix/sysv/linux/fstat64.c