} GET_HOST_TMP;
#define GET_HOST_BY_NAME(NAME, HP, ERR, TMP) \
{ \
- struct hostent *my_hp; \
- int my_h_err; \
- (HP) = (gethostbyname_r((NAME), &TMP.ent, \
- TMP.buf, sizeof (TMP.buf), &TMP.hp, \
- &my_h_err) \
+ struct hostent *my_hp = NULL; \
+ int my_h_err, my_ret; \
+ my_ret = gethostbyname_r((NAME), &TMP.ent, \
+ TMP.buf, sizeof (TMP.buf), &TMP.hp, \
+ &my_h_err); \
+ (HP) = (((my_ret != 0) || (TMP.hp != &TMP.ent)) \
? 0 \
: &TMP.ent); \
(ERR) = my_h_err; \
#define GET_HOST_BY_ADDR(ADDR, ADDRLEN, FAMILY, HP, ERR, TMP) \
{ \
struct hostent *my_hp; \
- int my_h_err; \
- (HP) = (gethostbyaddr_r((ADDR), (ADDRLEN), (FAMILY), &TMP.ent, \
- TMP.buf, sizeof (TMP.buf), &my_hp, \
- &my_h_err) \
+ int my_h_err, my_ret; \
+ my_ret = gethostbyaddr_r((ADDR), (ADDRLEN), (FAMILY), &TMP.ent, \
+ TMP.buf, sizeof (TMP.buf), &my_hp, \
+ &my_h_err); \
+ (HP) = (((my_ret != 0) || (TMP.hp != &TMP.ent)) \
? 0 \
: &TMP.ent); \
(ERR) = my_h_err; \