]> granicus.if.org Git - apache/commitdiff
Remove a thread un-safe function when APR_HAS_THREADS
authorRyan Bloom <rbb@apache.org>
Fri, 10 Nov 2000 18:16:52 +0000 (18:16 +0000)
committerRyan Bloom <rbb@apache.org>
Fri, 10 Nov 2000 18:16:52 +0000 (18:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86912 13f79535-47bb-0310-9956-ffa450edef68

STATUS
modules/mappers/mod_userdir.c

diff --git a/STATUS b/STATUS
index 9d325d3983a43a6ce15e5e0d76611d65912205fc..6a2a8158dd635bb97bb0ad49880160261aa8bc85 100644 (file)
--- 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.
 
index cec849bd39245a317868f60a482e808407bd4fbb..a9432c1403cd07cda9f5533ba86216baa9952989 100644 (file)
 #ifdef HAVE_PWD_H
 #include <pwd.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
 #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);