Revision f4e15b4b slirp/misc.c

b/slirp/misc.c
88 88
getouraddr()
89 89
{
90 90
	char buff[256];
91
	struct hostent *he;
92
	
93
	if (gethostname(buff,256) < 0)
94
	   return;
95
	
96
	if ((he = gethostbyname(buff)) == NULL)
97
	   return;
98
	
99
	our_addr = *(struct in_addr *)he->h_addr;
91
	struct hostent *he = NULL;
92
	
93
	if (gethostname(buff,256) == 0)
94
            he = gethostbyname(buff);
95
        if (he)
96
            our_addr = *(struct in_addr *)he->h_addr;
97
        /* If the host doesn't have a useful IP address then use the
98
           guest side address.  */
99
        if (our_addr.s_addr == 0 || our_addr.s_addr == loopback_addr.s_addr)
100
            our_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
100 101
}
101 102

  
102 103
#if SIZEOF_CHAR_P == 8

Also available in: Unified diff