summaryrefslogtreecommitdiff
path: root/file_io/unix
diff options
context:
space:
mode:
authorylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2017-03-29 00:00:11 +0000
committerylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2017-03-29 00:00:11 +0000
commite77dca0a2b6e3e829ac8e188179563e8ea461d78 (patch)
treea985c4c72aacea9b062bda9178267cc4b9a00651 /file_io/unix
parent9aa8403023bde3f89c1036b4e03398d7e1896879 (diff)
downloadlibapr-e77dca0a2b6e3e829ac8e188179563e8ea461d78.tar.gz
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). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1789258 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/unix')
-rw-r--r--file_io/unix/dir.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/file_io/unix/dir.c b/file_io/unix/dir.c
index 28d9e0699..a94eb8e7f 100644
--- a/file_io/unix/dir.c
+++ b/file_io/unix/dir.c
@@ -138,7 +138,9 @@ apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
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 *finfo, apr_int32_t wanted,
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) {