Previously, a listen address had to be specified by IP address;
hostnames where not supported. This patch should fix that. It is useful
for those who wish to use something like 'listenaddr = localhost',
though using the IP address is really recommended for most other
situations.
#else
char yes='1';
#endif /* sun */
+ struct hostent* he;
af = AF_INET;
#ifdef WITH_SDP
}
#endif
addrin.sin_port = htons(serve->port);
- if(!inet_aton(serve->listenaddr, &(addrin.sin_addr)))
+ if(!(he = gethostbyname(serve->listenaddr)))
err("could not parse listen address");
+ addrin.sin_addr = he->h_addr_list[0];
if (bind(serve->socket, (struct sockaddr *) &addrin, addrinlen) < 0)
err("bind: %m");
DEBUG("listen, ");