diff --git a/src/operations.cpp b/src/operations.cpp index 6e621c9be..e6c0d99a3 100644 --- a/src/operations.cpp +++ b/src/operations.cpp @@ -2113,18 +2113,21 @@ namespace inline int readdir_r_simulator(DIR * dirp, struct dirent * entry, struct dirent ** result)// *result set to 0 on end of directory { - errno = 0; - # if !defined(__CYGWIN__)\ && defined(_POSIX_THREAD_SAFE_FUNCTIONS)\ && defined(_SC_THREAD_SAFE_FUNCTIONS)\ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)\ && (!defined(__hpux) || defined(_REENTRANT)) \ && (!defined(_AIX) || defined(__THREAD_SAFE)) + + errno = 0; + if (::sysconf(_SC_THREAD_SAFE_FUNCTIONS)>= 0) { return ::readdir_r(dirp, entry, result); } # endif + errno = 0; + struct dirent * p; *result = 0; if ((p = ::readdir(dirp))== 0)