From: Ryan Bloom Date: Fri, 10 Nov 2000 18:16:52 +0000 (+0000) Subject: Remove a thread un-safe function when APR_HAS_THREADS X-Git-Tag: APACHE_2_0_ALPHA_8~110 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d45d0b523ce42a779f6f15da06fe98eed614d856;p=apache Remove a thread un-safe function when APR_HAS_THREADS git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86912 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 9d325d3983..6a2a8158dd 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ Apache 2.0 STATUS: -Last modified at [$Date: 2000/11/10 01:35:38 $] +Last modified at [$Date: 2000/11/10 18:16:51 $] Release: @@ -59,10 +59,6 @@ RELEASE SHOWSTOPPERS: BIND v9. Status: Greg asks, "why? doesn't gethostbyname_r() handle this?" - * There are still thread-unsafe functions used in the server. - - getpwnam in mod_userdir - - more? - * Modify mod_cgi and mod_cgid to deal with directories. This allows a lot of directives to be removed from the core. diff --git a/modules/mappers/mod_userdir.c b/modules/mappers/mod_userdir.c index cec849bd39..a9432c1403 100644 --- a/modules/mappers/mod_userdir.c +++ b/modules/mappers/mod_userdir.c @@ -106,6 +106,9 @@ #ifdef HAVE_PWD_H #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif #ifdef HAVE_STRINGS_H #include #endif @@ -322,7 +325,16 @@ static int translate_userdir(request_rec *r) return DECLINED; #else /* WIN32 */ struct passwd *pw; + +/*#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)*/ + struct passwd pwd; + size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char *buf = apr_pcalloc(r->pool, buflen); + + if (!getpwnam_r(w, &pwd, buf, buflen, &pw)) { +/*#else if ((pw = getpwnam(w))) { +#endif*/ #ifdef OS2 /* Need to manually add user name for OS/2 */ filename = apr_pstrcat(r->pool, pw->pw_dir, w, "/", userdir, NULL);