[gaim-migrate @ 10279]

Tue, 06 Jul 2004 05:37:16 +0000

author
Tim Ringenbach <marv@pidgin.im>
date
Tue, 06 Jul 2004 05:37:16 +0000
changeset 9455
b16e0c0ac03c
parent 9454
074ca0b0a7c5
child 9456
b5f072bbe9d2

[gaim-migrate @ 10279]
This makes us check that we have a valid fd in oscar before trying to
see what port it is on, so we don't fail g_return's and spew warnings.

This also fixes a bug I think KingAnt caused in network.c, which was making
gaim_network_do_listen() return -1 for me.

src/network.c file | annotate | diff | comparison | revisions
src/protocols/oscar/oscar.c file | annotate | diff | comparison | revisions
--- a/src/network.c	Mon Jul 05 19:33:48 2004 +0000
+++ b/src/network.c	Tue Jul 06 05:37:16 2004 +0000
@@ -178,12 +178,12 @@
 	 * XXX - Try IPv6 addresses first?
 	 */
 	for (next = res; next != NULL; next = next->ai_next) {
-		listenfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+		listenfd = socket(next->ai_family, next->ai_socktype, next->ai_protocol);
 		if (listenfd < 0)
 			continue;
 		if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) != 0)
 			gaim_debug_warning("network", "setsockopt: %s\n", strerror(errno));
-		if (bind(listenfd, res->ai_addr, res->ai_addrlen) == 0)
+		if (bind(listenfd, next->ai_addr, next->ai_addrlen) == 0)
 			break; /* success */
 		close(listenfd);
 	}
--- a/src/protocols/oscar/oscar.c	Mon Jul 05 19:33:48 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Tue Jul 06 05:37:16 2004 +0000
@@ -1309,7 +1309,8 @@
 
 	listenfd = gaim_network_listen_range(5190, 5199);
 	ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1);
-	dim->conn = aim_odc_initiate(od->sess, who, listenfd, gaim_network_ip_atoi(ip), gaim_network_get_port_from_fd(listenfd), cookie);
+	if (listenfd >= 0)
+		dim->conn = aim_odc_initiate(od->sess, who, listenfd, gaim_network_ip_atoi(ip), gaim_network_get_port_from_fd(listenfd), cookie);
 	if (dim->conn != NULL) {
 		char *tmp;
 		GaimConversation *conv;

mercurial