You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2017/03/29 00:00:11 UTC
svn commit: r1789258 - /apr/apr/trunk/file_io/unix/dir.c
Author: ylavic
Date: Wed Mar 29 00:00:11 2017
New Revision: 1789258
URL: http://svn.apache.org/viewvc?rev=1789258&view=rev
Log:
apr_dir_read: Since readdir() is now thread safe on most (if not all) unixes
and readdir_r() is defective and deprecated, use the former by default unless
APR_USE_READDIR_R is defined (no use case currently hence not autoconfigured).
Modified:
apr/apr/trunk/file_io/unix/dir.c
Modified: apr/apr/trunk/file_io/unix/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/dir.c?rev=1789258&r1=1789257&r2=1789258&view=diff
==============================================================================
--- apr/apr/trunk/file_io/unix/dir.c (original)
+++ apr/apr/trunk/file_io/unix/dir.c Wed Mar 29 00:00:11 2017
@@ -138,7 +138,9 @@ apr_status_t apr_dir_read(apr_finfo_t *f
apr_filetype_e type;
#endif
#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
- && !defined(READDIR_IS_THREAD_SAFE)
+ && !defined(READDIR_IS_THREAD_SAFE) \
+ && (defined(APR_USE_READDIR64_R) \
+ || defined(APR_USE_READDIR_R))
#ifdef APR_USE_READDIR64_R
struct dirent64 *retent;
@@ -179,9 +181,10 @@ apr_status_t apr_dir_read(apr_finfo_t *f
ret = APR_ENOENT;
}
#else
- /* We're about to call a non-thread-safe readdir() that may
- possibly set `errno', and the logic below actually cares about
- errno after the call. Therefore we need to clear errno first. */
+ /* We're about to call readdir() that may possibly set errno, and the
+ * logic below actually cares about errno after the call. Therefore
+ * we need to clear errno first.
+ */
errno = 0;
thedir->entry = readdir(thedir->dirstruct);
if (thedir->entry == NULL) {