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)
committerReinhard Tartler <siretart@tauware.de>
Thu, 5 Jan 2012 21:26:55 +0000 (22:26 +0100)
This fixes bind(8080): Address family not supported by protocol.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
ffserver.c

index 179cac4..bab58d1 100644 (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));