Commit d73ba584 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo Committed by GitHub
Browse files

Merge pull request #72 from erikd/topic/readdir-deprecated

Don't use readdir_r if deprecated
parents cd6eae1d 2951cd01
......@@ -36,13 +36,30 @@ int __hsunix_push_module(int fd, const char *module)
* GNU glibc 2.23 and later deprecate `readdir_r` in favour of plain old
* `readdir` which in some upcoming POSIX standard is going to required to be
* re-entrant.
* Eventually we want to drop `readder_r` all together, but want to be
* compatible with older unixen which may not have a re-entrant `readdir`.
* Solution is to make systems with *known* re-entrant `readir` use that and use
* `readdir_r` whereever we have it and don't *know* that `readdir` is
* re-entrant.
#if defined (__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 23)
#define USE_READDIR_R 0
#define USE_READDIR_R 1
* read an entry from the directory stream; opt for the
* re-entrant friendly way of doing this, if available.
int __hscore_readdir( DIR *dirPtr, struct dirent **pDirEnt )
struct dirent* p;
int res;
static unsigned int nm_max = (unsigned int)-1;
# Changelog for [`unix` package](
## *Sep 2016*
* Don't use `readdir_r` if its deprecated.
## *Apr 2016*
* Bundled with GHC 8.0.1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment