avserver: Fix a bug where the socket is IPv4, but IPv6 is autoselected for the loopba...
authorNathan Caldwell <saintdev@gmail.com>
Wed, 28 Sep 2011 00:48:43 +0000 (18:48 -0600)
committerAnton Khirnov <anton@khirnov.net>
Fri, 30 Sep 2011 19:33:52 +0000 (21:33 +0200)
This fixes bind(8080): Address family not supported by protocol.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
avserver.c

index d0a14aa..7b8bf13 100644 (file)
@@ -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));