sysdeps/posix/telldir.c converts an off_t value (dirp->filepos) to a long int return value with no overflow check. On platforms where long int is smaller than the default off_t (currently just x32, but will include RISC-V 32-bit in future, given the intent that that will only support 64-bit times and thus will only support 64-bit offsets), it should check for overflow in the conversion and produce an EOVERFLOW error in that case. (This is related to but separate from bug 23960; a kernel facility to request 32-bit offsets to avoid that bug might avoid some overflows occurring, but only if such requests are made by glibc in the configurations with 32-bit long, not just the configurations with 32-bit off_t.)
Should we add telldir64 and seekdir64?
My view on new APIs for this case would be telldiro / seekdiro / telldiro64 / seekdiro64, by analogy with fseeko / ftello.