Commit f5e717f3 authored by Nathan Caldwell's avatar Nathan Caldwell Committed by Anton Khirnov

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: 's avatarAnton Khirnov <anton@khirnov.net>
parent e81e5e8a
......@@ -522,6 +522,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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment