From f7b4d7a55de6bd750dd30475da4f72c271650a59 Mon Sep 17 00:00:00 2001 From: znek Date: Tue, 7 Aug 2007 15:16:41 +0000 Subject: [PATCH] ported to recent FreeBSD git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1522 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-core/NGStreams/ChangeLog | 9 +++++++++ sope-core/NGStreams/NGInternetSocketAddress.m | 8 ++++---- sope-core/NGStreams/Version | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sope-core/NGStreams/ChangeLog b/sope-core/NGStreams/ChangeLog index 10c26c59..843c1b74 100644 --- a/sope-core/NGStreams/ChangeLog +++ b/sope-core/NGStreams/ChangeLog @@ -1,3 +1,12 @@ +2007-08-07 Marcus Mueller + + * NGInternetSocketAddress.m: do not define USE_GETHOSTBYNAME_R on + FreeBSD (although HAVE_GETHOSTBYNAME_R is defined). It appears + gethostbyname() is thread safe on FreeBSD and there are 3 API + versions of gethostbyname_r(), which isn't worth the hassle + to check in this case. Changed code to consequently use + USE_GETHOSTBYNAME_R. (v4.7.52) + 2006-07-04 Helge Hess * 64bit fixes (v4.5.51) diff --git a/sope-core/NGStreams/NGInternetSocketAddress.m b/sope-core/NGStreams/NGInternetSocketAddress.m index 40efcfd5..7634e803 100644 --- a/sope-core/NGStreams/NGInternetSocketAddress.m +++ b/sope-core/NGStreams/NGInternetSocketAddress.m @@ -48,7 +48,7 @@ #include "NGInternetSocketDomain.h" #include "common.h" -#if defined(HAVE_GETHOSTBYNAME_R) && !defined(linux) +#if defined(HAVE_GETHOSTBYNAME_R) && !defined(linux) && !defined(__FreeBSD__) #define USE_GETHOSTBYNAME_R 1 #endif @@ -140,7 +140,7 @@ static inline NSString *_nameOfLocalhost(void) { #if USE_GETHOSTBYNAME_R struct hostent hostEntityBuffer; char buffer[8200]; - + hostEntity = gethostbyaddr_r((char *)&(sockAddr->sin_addr.s_addr), 4, [[self domain] socketDomain], @@ -277,14 +277,14 @@ static inline NSString *_nameOfLocalhost(void) { BOOL didFail = NO; int errorCode = 0; int addrType = AF_INET; -#if defined(HAVE_GETHOSTBYNAME_R) && !defined(linux) +#if defined(USE_GETHOSTBYNAME_R) char buffer[4096]; struct hostent hostEntity; #else struct hostent *hostEntity; // only valid during lock #endif -#if defined(HAVE_GETHOSTBYNAME_R) && !defined(linux) +#if defined(USE_GETHOSTBYNAME_R) if (gethostbyname_r(chost, &hostEntity, buffer, sizeof(buffer), &errorCode) == NULL) { didFail = YES; diff --git a/sope-core/NGStreams/Version b/sope-core/NGStreams/Version index b8f0fed5..063faafb 100644 --- a/sope-core/NGStreams/Version +++ b/sope-core/NGStreams/Version @@ -1,3 +1,3 @@ # version file -SUBMINOR_VERSION:=51 +SUBMINOR_VERSION:=52 -- 2.39.5