diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-04-14 17:41:56 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-05-27 11:55:00 -0300 |
commit | ef3330fde49502c342cf0541cd3c283a3c4a79cd (patch) | |
tree | d65866211082bde5585bdeafa668908c9f21e38f /sysdeps | |
parent | 415d0b0b3f1649d688f18c34bcfb16ad72e337ce (diff) | |
download | glibc-ef3330fde49502c342cf0541cd3c283a3c4a79cd.tar.gz glibc-ef3330fde49502c342cf0541cd3c283a3c4a79cd.tar.xz glibc-ef3330fde49502c342cf0541cd3c283a3c4a79cd.zip |
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.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/posix/telldir.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sysdeps/posix/telldir.c b/sysdeps/posix/telldir.c index 1bb822c807..57d435ed21 100644 --- a/sysdeps/posix/telldir.c +++ b/sysdeps/posix/telldir.c @@ -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; } |