]> git.ipfire.org Git - thirdparty/glibc.git/commit
linux: Set internal DIR filepos as off64_t (BZ #23960, BZ #24050) azanella/bz23960-dirent
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 13 Apr 2020 21:09:20 +0000 (18:09 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 29 Dec 2023 19:48:51 +0000 (16:48 -0300)
commit283cd0eca5b50a77372f2f201acd24cd223db310
tree8dee2fbab353697c67f2fbdb6d4b7b2137414478
parent5c2728e451fa15b97b5161ffd20cf647b54f39e6
linux: Set internal DIR filepos as off64_t (BZ #23960, BZ #24050)

It allows to obtain the expected entry offset on telldir and set
it correctly on seekdir on platforms where long int is smaller
than off64_t.

On such cases opendir creates a map entry between the DIR d_off
offset and the returned long int (the telldir return value).
seekdir will then set the correct offset from the internal list
using the telldir as the list key.

It also removes the overflow check on readdir and the returned value
will be truncated by the non-LFS off_t size.  As Joseph has noted
in BZ #23960 comment #22, d_off is an opaque value and since
telldir/seekdir works regardless of the returned dirent d_off value.

Finally it removes the requirement to check for overflow values on
telldir (BZ #24050).

Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu,
and arm-linux-gnueabihf.
15 files changed:
include/dirent.h
sysdeps/unix/sysv/linux/Makefile
sysdeps/unix/sysv/linux/alpha/bits/dirent.h
sysdeps/unix/sysv/linux/bits/dirent.h
sysdeps/unix/sysv/linux/closedir.c
sysdeps/unix/sysv/linux/dirstream.h
sysdeps/unix/sysv/linux/opendir.c
sysdeps/unix/sysv/linux/readdir.c
sysdeps/unix/sysv/linux/readdir64.c
sysdeps/unix/sysv/linux/rewinddir.c
sysdeps/unix/sysv/linux/seekdir.c
sysdeps/unix/sysv/linux/telldir.c
sysdeps/unix/sysv/linux/telldir.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/tst-opendir-lfs.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/tst-opendir.c [new file with mode: 0644]