aix/hpux gethostbyname_r
This commit is contained in:
parent
ddaba2182d
commit
2debe9948e
@ -1553,12 +1553,18 @@ static int fqdn_ip_get(sigar_t *sigar, char *name)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GETHOSTBYNAME_LEN 512
|
#define GETHOSTBYNAME_LEN 512
|
||||||
|
#if defined(__hpux) || defined(_AIX)
|
||||||
|
#define HAS_HOSTENT_DATA
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct hostent *sigar_gethostbyname(const char *name)
|
static struct hostent *sigar_gethostbyname(const char *name)
|
||||||
{
|
{
|
||||||
char buffer[GETHOSTBYNAME_LEN];
|
char buffer[GETHOSTBYNAME_LEN];
|
||||||
struct hostent hs, *hp;
|
struct hostent hs, *hp;
|
||||||
int err;
|
int err;
|
||||||
|
#if defined(HAS_HOSTENT_DATA)
|
||||||
|
struct hostent_data hd;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
gethostbyname_r(name, &hs, buffer, sizeof(buffer),
|
gethostbyname_r(name, &hs, buffer, sizeof(buffer),
|
||||||
@ -1566,6 +1572,9 @@ static struct hostent *sigar_gethostbyname(const char *name)
|
|||||||
#elif defined(__sun)
|
#elif defined(__sun)
|
||||||
hp = gethostbyname_r(name, &hs, buffer, sizeof(buffer),
|
hp = gethostbyname_r(name, &hs, buffer, sizeof(buffer),
|
||||||
&err);
|
&err);
|
||||||
|
#elif defined(HAS_HOSTENT_DATA)
|
||||||
|
gethostbyname_r(name, &hs, &hd);
|
||||||
|
hp = &hs;
|
||||||
#else
|
#else
|
||||||
hp = gethostbyname(name);
|
hp = gethostbyname(name);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user