summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2019-04-01 17:37:16 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2019-04-01 17:37:16 +0000
commit7bed82961086a2fe69e5606f583dd374dddfa263 (patch)
treee00efd6bd7d0dbc4a00e3d8b061b62c909819905
parent65622e8cfb3074636008938d2d0dedf740d03d48 (diff)
downloadlibapr-7bed82961086a2fe69e5606f583dd374dddfa263.tar.gz
Revert r1789258, r1856189, r1856191 following discussion on list, in favor
of a simpler path of avoiding dirread_r always, by default. This saves us various additional detection logic, and follows advice of library maintainers and our library's behavior, any apparent "thread safety" offered by the _r() flavors of this function were not truly supported by APR's allocation or dirread_r reentrancy of parallel threads attemping to access the same open directory descriptor. Retains r1856192, r1856196 to avoid wasteful allocation in the dirread() case. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1856755 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--configure.in25
-rw-r--r--file_io/unix/dir.c7
2 files changed, 4 insertions, 28 deletions
diff --git a/configure.in b/configure.in
index 959a55846..a55106977 100644
--- a/configure.in
+++ b/configure.in
@@ -845,31 +845,8 @@ ac_cv_define_GETSERVBYNAME_IS_THREAD_SAFE=no
if test "$threads" = "1"; then
AC_MSG_NOTICE([APR will use threads])
AC_CHECK_LIB(c_r, readdir,
- apr_readdir_is_thread_safe=yes)
- if test "x$apr_readdir_is_thread_safe" = "x"; then
- AC_CHECK_HEADERS(dirent.h)
- AC_CHECK_FUNCS(readdir_r)
- APR_IFALLYES(header:dirent.h func:readdir_r,
- apr_has_readdir_r="1", apr_has_readdir_r="0")
- if test "$apr_has_readdir_r" = "1"; then
- dnl readdir_r() may exist but be deprecated, meaning
- dnl the readdir() itself is thread-safe
- APR_TRY_COMPILE_NO_WARNING([
- #include <sys/types.h>
- #include <dirent.h>
- ],
- [
- DIR *dir = opendir("/tmp");
- struct dirent entry, *result;
- return readdir_r(dir, &entry, &result) != 0;
- ], apr_readdir_is_thread_safe=no, apr_readdir_is_thread_safe=yes)
- fi
- fi
- if test "$apr_readdir_is_thread_safe" = "yes"; then
- AC_MSG_NOTICE([APR will use thread-safe readdir()])
AC_DEFINE(READDIR_IS_THREAD_SAFE, 1,
- [Define if readdir is thread safe])
- fi
+ [Define if readdir is thread safe]))
if test "x$apr_gethostbyname_is_thread_safe" = "x"; then
AC_CHECK_LIB(c_r, gethostbyname, apr_gethostbyname_is_thread_safe=yes)
fi
diff --git a/file_io/unix/dir.c b/file_io/unix/dir.c
index b2dd95513..d9b344f30 100644
--- a/file_io/unix/dir.c
+++ b/file_io/unix/dir.c
@@ -188,10 +188,9 @@ apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
ret = APR_ENOENT;
}
#else
- /* 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.
- */
+ /* 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. */
errno = 0;
thedir->entry = readdir(thedir->dirstruct);
if (thedir->entry == NULL) {