linux: Use internal DIR locks when accessing filepos on telldir

Since it might change during a readdir call.

Checked on x86_64-linux-gnu and i686-linux-gnu.
This commit is contained in:
Adhemerval Zanella 2020-04-14 17:41:56 -03:00
parent 415d0b0b3f
commit ef3330fde4

View File

@ -23,5 +23,11 @@
long int
telldir (DIR *dirp)
{
return dirp->filepos;
long int ret;
__libc_lock_lock (dirp->lock);
ret = dirp->filepos;
__libc_lock_unlock (dirp->lock);
return ret;
}