avserver: Fix a bug where the socket is IPv4, but IPv6 is autoselected for the loopback address.

This fixes bind(8080): Address family not supported by protocol.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit f5e717f3c7)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
This commit is contained in:
Nathan Caldwell 2011-09-27 18:48:43 -06:00 committed by Reinhard Tartler
parent 82a11fcff2
commit 06df542067
1 changed files with 1 additions and 0 deletions

View File

@ -516,6 +516,7 @@ static int socket_open_listen(struct sockaddr_in *my_addr)
tmp = 1;
setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
my_addr->sin_family = AF_INET;
if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) {
char bindmsg[32];
snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)", ntohs(my_addr->sin_port));