diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2011-11-18 19:52:45 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2011-11-21 17:10:07 +0000 |
commit | 161ff9a4430472eaffbb438d25b5c6b5824c50fd (patch) | |
tree | a973ae5d6634bfaa401e08824eae0cf642edcda3 /sal | |
parent | 7a357d93d8bc7cc47b6352546a47973379f513e4 (diff) |
Replace gethostbyname by _osl_gethostbyname_r in socket.c .
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/socket.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index ed31a82a6724..d47146323df1 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -1014,22 +1014,17 @@ oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *ustrHostname) oslHostAddr SAL_CALL osl_psz_createHostAddrByName (const sal_Char *pszHostname) { - struct hostent *he; - oslHostAddr addr; + struct hostent aHe; + struct hostent *pHe; + sal_Char heBuffer[ MAX_HOSTBUFFER_SIZE ]; + int nErrorNo; - static oslMutex mutex = NULL; + pHe = _osl_gethostbyname_r ( + pszHostname, + &aHe, heBuffer, + sizeof(heBuffer), &nErrorNo ); - if (mutex == NULL) - mutex = osl_createMutex(); - - osl_acquireMutex(mutex); - - he = gethostbyname((sal_Char *)pszHostname); - addr = _osl_hostentToHostAddr (he); - - osl_releaseMutex(mutex); - - return addr; + return _osl_hostentToHostAddr (pHe); } /*****************************************************************************/ |