fix DNS resolution by using thread-safe functions; patch from marc@

bump PKGNAME. from maintainer Dan Weeks
This commit is contained in:
pvalchev 2003-02-24 06:44:26 +00:00
parent 05c1cfff57
commit a3ee7092c5
2 changed files with 43 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.2 2003/02/15 17:15:35 naddy Exp $
# $OpenBSD: Makefile,v 1.3 2003/02/24 06:44:26 pvalchev Exp $
COMMENT= "web proxy with advanced filtering capabilities"
DISTNAME= privoxy-3.0.0-stable
PKGNAME= ${DISTNAME:S/-stable//}
PKGNAME= ${DISTNAME:S/-stable//}p0
CATEGORIES= www
HOMEPAGE= http://www.privoxy.org/

View File

@ -0,0 +1,41 @@
$OpenBSD: patch-jbsockets.c,v 1.1 2003/02/24 06:44:26 pvalchev Exp $
--- jbsockets.c.orig Sun May 26 16:41:27 2002
+++ jbsockets.c Thu Feb 13 13:44:58 2003
@@ -185,6 +185,7 @@ const char jbsockets_rcs[] = "$Id: jbsoc
#include "config.h"
+#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -710,8 +711,13 @@ int accept_connection(struct client_stat
host = NULL;
}
#else
- host = gethostbyaddr((const char *)&server.sin_addr,
- sizeof(server.sin_addr), AF_INET);
+ {
+ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&mutex);
+ host = gethostbyaddr((const char *)&server.sin_addr,
+ sizeof(server.sin_addr), AF_INET);
+ pthread_mutex_unlock(&mutex);
+ }
#endif
if (host == NULL)
{
@@ -784,7 +790,12 @@ unsigned long resolve_hostname_to_ip(con
hostp = NULL;
}
#else
- hostp = gethostbyname(host);
+ {
+ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&mutex);
+ hostp = gethostbyname(host);
+ pthread_mutex_unlock(&mutex);
+ }
#endif /* def HAVE_GETHOSTBYNAME_R_(6|5|3)_ARGS */
if (hostp == NULL)
{