diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2011-11-18 19:54:28 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2011-11-21 17:10:07 +0000 |
commit | af19d9f563667376f759b4526bc1bcb056947394 (patch) | |
tree | 80da39ed31f0972dc94b385910987c1e6fdd5a25 /sal/osl/unx | |
parent | 161ff9a4430472eaffbb438d25b5c6b5824c50fd (diff) |
Remove internal gethostbyname_r implementation.
Diffstat (limited to 'sal/osl/unx')
-rw-r--r-- | sal/osl/unx/system.c | 94 | ||||
-rw-r--r-- | sal/osl/unx/system.h | 4 |
2 files changed, 0 insertions, 98 deletions
diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c index 4bb0e4643d1f..63d67bcf46f2 100644 --- a/sal/osl/unx/system.c +++ b/sal/osl/unx/system.c @@ -32,100 +32,6 @@ static pthread_mutex_t getrtl_mutex = PTHREAD_MUTEX_INITIALIZER; -/* struct passwd differs on some platforms */ -#if !defined(FREEBSD) || (__FreeBSD_version < 601103) - -extern int h_errno; - -struct hostent *gethostbyname_r(const char *name, struct hostent *result, - char *buffer, int buflen, int *h_errnop) -{ - /* buffer layout: name\0 - * array_of_pointer_to_aliases - * NULL - * alias1\0...aliasn\0 - * array_of_pointer_to_addresses - * NULL - * addr1addr2addr3...addrn - */ - struct hostent* res; - - pthread_mutex_lock(&getrtl_mutex); - - if ( (res = gethostbyname(name)) ) - { - int nname, naliases, naddr_list, naliasesdata, n; - char **p, **parray, *data; - - /* Check buffer size before copying, we want to leave the - * buffers unmodified in case something goes wrong. - * - * Is this required? - */ - - nname= strlen(res->h_name)+1; - - naliases = naddr_list = naliasesdata = 0; - - for ( p = res->h_aliases; *p != NULL; p++) { - naliases++; - naliasesdata += strlen(*p)+1; - } - - for ( p = res->h_addr_list; *p != NULL; p++) - naddr_list++; - - if ( nname - + (naliases+1)*sizeof(char*) + naliasesdata - + (naddr_list+1)*sizeof(char*) + naddr_list*res->h_length - <= buflen ) - { - memcpy(result, res, sizeof(struct hostent)); - - strcpy(buffer, res->h_name); - result->h_name = buffer; - buffer += nname; - - parray = (char**)buffer; - result->h_aliases = parray; - data = buffer + (naliases+1)*sizeof(char*); - for ( p = res->h_aliases; *p != NULL; p++) { - n = strlen(*p)+1; - *parray++ = data; - memcpy(data, *p, n); - data += n; - } - *parray = NULL; - buffer = data; - parray = (char**)buffer; - result->h_addr_list = parray; - data = buffer + (naddr_list+1)*sizeof(char*); - for ( p = res->h_addr_list; *p != NULL; p++) { - *parray++ = data; - memcpy(data, *p, res->h_length); - data += res->h_length; - } - *parray = NULL; - - res = result; - } - else - { - errno = ERANGE; - res = NULL; - } - } - else - { - *h_errnop = h_errno; - } - - pthread_mutex_unlock(&getrtl_mutex); - - return res; -} -#endif /* !defined(FREEBSD) || (__FreeBSD_version < 601103) */ - #if defined(MACOSX) /* * Add support for resolving Mac native alias files (not the same as unix alias files) diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h index c8f487170ba5..d3293ad6ceb0 100644 --- a/sal/osl/unx/system.h +++ b/sal/osl/unx/system.h @@ -504,10 +504,6 @@ extern struct spwd *getspnam_r(const char *name, struct spwd *result, struct tm *localtime_r(const time_t *timep, struct tm *buffer); struct tm *gmtime_r(const time_t *timep, struct tm *buffer); #endif /* !defined FREEBSD || (__FreeBSD_version < 500112) */ -#if !defined(FREEBSD) || (__FreeBSD_version < 601103) -struct hostent *gethostbyname_r(const char *name, struct hostent *result, - char *buffer, int buflen, int *h_errnop); -#endif /* !defined(FREEBSD) || (__FreeBSD_version < 601103) */ #endif #endif /* __OSL_SYSTEM_H__ */ |