-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use readdir_r on Linux and Android #68
Conversation
readdir_r has been deprecated and has problems of its own[1]. glibc 2.24 marked readdir_r as deprecated and may eventually remove it. At the same time, plain readdir is thread-safe if different threads call it for different directory streams, which is fine in our case. [1]: http://man7.org/linux/man-pages/man3/readdir_r.3.html
Apart from avoiding to use the deprecated functionality, this patch fixes issue #72. I.e. the patch is useful not only for GNU/Linux, but also for Android/Linux. Android NDK developers recommend to use About thread-safety of
|
This is an explicit fix for this bug: boostorg#72 Android developers recommend using readdir instead of readdir_r as it is already thread-safe: http://elliotth.blogspot.com/2012/10/how-not-to-use-readdirr3.html
Non-maintainer review of the patch. Hopefully will help the maintainers to spend less time on their official review. The patch is tiny, straightforward, very understandable. The patch adds conditions checking for The patch can benefit from comment(s), explaining why a condition was added. Even if the patch can be improved, I think it is already good and can be merged in. |
I just ran into this while building with "warnings as errors" in iostreams:
Any reason why this hasn't been merged? |
readdir_r
has been deprecated and has problems of its own1. glibc 2.24 markedreaddir_r
as deprecated and may eventually remove it. At the same time, plainreaddir
is thread-safe if different threads call it for different directorystreams, which is fine in our case.