pidgin: 1def2be2: dns: I don't think this worked correctly...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sat Oct 31 23:15:31 EDT 2009


-----------------------------------------------------------------
Revision: 1def2be2e4073bd8f441667545132de3b851cd71
Ancestor: 9aa42ac12c29a38b88df8f997c1e9e496234180d
Author: darkrain42 at pidgin.im
Date: 2009-11-01T00:12:38
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1def2be2e4073bd8f441667545132de3b851cd71

Modified files:
        libpurple/dnsquery.c

ChangeLog: 

dns: I don't think this worked correctly before.

Closing child_out and then continuing means that this DNS child would
hang around but have no means of communicating to the parent.  I added
one of these, but the second has existed since the DNS forking
was introduced way back in fb8fbdd2118703058de16589570503043bc588fd.

Instead, let's take the safe route and just kill off the child in these
circumstances.

-------------- next part --------------
============================================================
--- libpurple/dnsquery.c	bc92bfea1af919b6b93181950d4a922e55053a73
+++ libpurple/dnsquery.c	f163af06a596556d8b1b1d559e30b4b1612e7533
@@ -295,12 +295,11 @@ purple_dnsquery_resolver_run(int child_o
 			rc = purple_network_convert_idn_to_ascii(dns_params.hostname, &hostname);
 			if (rc != 0) {
 				write_to_parent(child_out, &rc, sizeof(rc));
-				close(child_out);
 				if (show_debug)
 					fprintf(stderr, "dns[%d] Error: IDN conversion returned "
 							"%d\n", getpid(), rc);
 				dns_params.hostname[0] = '\0';
-				continue;
+				break;
 			}
 		} else /* intentional to execute the g_strdup */
 #endif
@@ -325,14 +324,13 @@ purple_dnsquery_resolver_run(int child_o
 		rc = getaddrinfo(hostname, servname, &hints, &res);
 		write_to_parent(child_out, &rc, sizeof(rc));
 		if (rc != 0) {
-			close(child_out);
 			if (show_debug)
 				printf("dns[%d] Error: getaddrinfo returned %d\n",
 					getpid(), rc);
 			dns_params.hostname[0] = '\0';
 			g_free(hostname);
 			hostname = NULL;
-			continue;
+			break;
 		}
 		tmp = res;
 		while (res) {


More information about the Commits mailing list