[gnome-user-share] Fix http sharing not workin on Linux 3.0



commit 24cc0e2ecc60619af0e51e730ef68bf750182dcf
Author: Adam Glasgall <adam crossproduct net>
Date:   Mon Oct 17 14:40:29 2011 +0100

    Fix http sharing not workin on Linux 3.0
    
    gnome-user-share tries to discover a free port to run Apache on by
    bind()ing a struct sockaddr_in with no port specified in
    src/http.c:get_port(). However, it neglects to specify an address
    family, so that attempt fails with EINVAL, and the -1 returned gets
    passed to spawn_httpd() as the port that Apache should be listening on,
    which causes to Apache promptly and silently bail.
    
    This error was caused by a regression in Linux 3.0:
    http://thread.gmane.org/gmane.linux.network/205326/focus=205328
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660146

 src/http.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/src/http.c b/src/http.c
index 3367d2a..52bd5eb 100644
--- a/src/http.c
+++ b/src/http.c
@@ -77,6 +77,7 @@ get_port (void)
 	memset (&addr, 0, sizeof (addr));
 	addr.sin_port = 0;
 	addr.sin_addr.s_addr = INADDR_ANY;
+	addr.sin_family = AF_INET;
 
 	reuse = 1;
 	setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof (reuse));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]