Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1282,30 +1282,10 @@ ]) AC_CHECK_FUNCS([lstat]) AC_CHECK_MEMBERS([struct stat.st_birthtime], [], [], [ #include ]) - - old_OBJCFLAGS="$OBJCFLAGS" - OBJCFLAGS="$OBJCFLAGS -Werror" - AC_MSG_CHECKING(for readdir_r) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([ - #include - ], [ - DIR *dir = 0; - struct dirent entry, *result; - - readdir_r(dir, &entry, &result); - ]) - ], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_READDIR_R, 1, [Whether we have readdir_r()]) - ], [ - AC_MSG_RESULT(no) - ]) - OBJCFLAGS="$old_OBJCFLAGS" ]) AC_CHECK_HEADERS(dirent.h) AC_CHECK_FUNCS([sysconf gmtime_r localtime_r]) Index: src/OFFileIRIHandler.m ================================================================== --- src/OFFileIRIHandler.m +++ src/OFFileIRIHandler.m @@ -138,11 +138,11 @@ releasePasswdMutex(void) { [passwdMutex release]; } #endif -#if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) && !defined(OF_WINDOWS) +#if defined(OF_HAVE_THREADS) && !defined(__GLIBC__) && !defined(OF_WINDOWS) static OFMutex *readdirMutex; static void releaseReaddirMutex(void) { @@ -773,11 +773,11 @@ #if defined(OF_FILE_MANAGER_SUPPORTS_OWNER) && defined(OF_HAVE_THREADS) passwdMutex = [[OFMutex alloc] init]; atexit(releasePasswdMutex); #endif -#if !defined(HAVE_READDIR_R) && !defined(OF_WINDOWS) && defined(OF_HAVE_THREADS) +#if defined(OF_HAVE_THREADS) && !defined(__GLIBC__) && !defined(OF_WINDOWS) readdirMutex = [[OFMutex alloc] init]; atexit(releaseReaddirMutex); #endif #ifdef OF_WINDOWS @@ -1420,11 +1420,11 @@ if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL) @throw [OFOpenItemFailedException exceptionWithIRI: IRI mode: nil errNo: errno]; -# if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) +# if defined(OF_HAVE_THREADS) && !defined(__GLIBC__) @try { [readdirMutex lock]; } @catch (id e) { closedir(dir); @throw e; @@ -1432,25 +1432,12 @@ # endif @try { for (;;) { struct dirent *dirent; -# ifdef HAVE_READDIR_R - struct dirent buffer; -# endif OFString *file; -# ifdef HAVE_READDIR_R - if (readdir_r(dir, &buffer, &dirent) != 0) - @throw [OFReadFailedException - exceptionWithObject: self - requestedLength: 0 - errNo: errno]; - - if (dirent == NULL) - break; -# else errno = 0; if ((dirent = readdir(dir)) == NULL) { if (errno == 0) break; else @@ -1457,11 +1444,10 @@ @throw [OFReadFailedException exceptionWithObject: self requestedLength: 0 errNo: errno]; } -# endif if (strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name, "..") == 0) continue; @@ -1474,11 +1460,11 @@ [file release]; } } } @finally { closedir(dir); -# if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) +# if defined(OF_HAVE_THREADS) && !defined(__GLIBC__) [readdirMutex unlock]; # endif } #endif