changeset 24030:d31ceef11df1

merge of 'aaddbdd76370264a6f95b6d787b565061e3b40d6' and 'ab9a8e940ca290009deae6e3044bc352a0cd9223'
author Kevin Stange <kevin@simguy.net>
date Thu, 11 Sep 2008 20:58:15 +0000
parents dc25ef2669f6 (current diff) ec85a522b455 (diff)
children 1efbc28b5042 f5b03b4536bb
files
diffstat 2 files changed, 10 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/dnsquery.c	Thu Sep 11 20:58:09 2008 +0000
+++ b/libpurple/dnsquery.c	Thu Sep 11 20:58:15 2008 +0000
@@ -209,17 +209,6 @@
 	 * the result back to our parent, when finished.
 	 */
 	while (1) {
-		const char ch = 'Y';
-		fd_set fds;
-		struct timeval tv = { .tv_sec = 40 , .tv_usec = 0 };
-		FD_ZERO(&fds);
-		FD_SET(child_in, &fds);
-		rc = select(child_in + 1, &fds, NULL, NULL, &tv);
-		if (!rc) {
-			if (show_debug)
-				printf("dns[%d]: nobody needs me... =(\n", getpid());
-			break;
-		}
 		rc = read(child_in, &dns_params, sizeof(dns_params_t));
 		if (rc < 0) {
 			fprintf(stderr, "dns[%d]: Error: Could not read dns_params: "
@@ -237,8 +226,6 @@
 					dns_params.port);
 			_exit(1);
 		}
-		/* Tell our parent that we read the data successfully */
-		write_to_parent(child_out, &ch, sizeof(ch));
 
 		/* We have the hostname and port, now resolve the IP */
 
@@ -425,8 +412,7 @@
 {
 	pid_t pid;
 	dns_params_t dns_params;
-	int rc;
-	char ch;
+	ssize_t rc;
 
 	/* This waitpid might return the child's PID if it has recently
 	 * exited, or it might return an error if it exited "long
@@ -458,16 +444,10 @@
 		purple_dnsquery_resolver_destroy(resolver);
 		return FALSE;
 	}
-
-	g_return_val_if_fail(rc == sizeof(dns_params), -1);
-
-	/* Did you hear me? (This avoids some race conditions) */
-	rc = read(resolver->fd_out, &ch, sizeof(ch));
-	if (rc != 1 || ch != 'Y')
-	{
-		purple_debug_warning("dns",
-				"DNS child %d not responding. Killing it!\n",
-				resolver->dns_pid);
+	if (rc < sizeof(dns_params)) {
+		purple_debug_error("dns", "Tried to read %" G_GSSIZE_FORMAT
+				" bytes from child but only read %" G_GSSIZE_FORMAT "\n",
+				sizeof(dns_params), rc);
 		purple_dnsquery_resolver_destroy(resolver);
 		return FALSE;
 	}
--- a/libpurple/protocols/msn/soap.c	Thu Sep 11 20:58:09 2008 +0000
+++ b/libpurple/protocols/msn/soap.c	Thu Sep 11 20:58:15 2008 +0000
@@ -284,6 +284,11 @@
 		count += cnt;
 		g_string_append_len(conn->buf, buf, cnt);
 	}
+
+	perrno = errno;
+	if (cnt < 0 && perrno != EAGAIN)
+		purple_debug_info("soap", "read: %s\n", g_strerror(perrno));
+
 #ifndef MSN_UNSAFE_DEBUG
 	if (conn->current_request->secure)
 		purple_debug_misc("soap", "Received secure request.\n");
@@ -299,11 +304,9 @@
 		return;
 
 	/* msn_soap_process could alter errno */
-	perrno = errno;
 	msn_soap_process(conn);
 	
 	if (cnt < 0 && perrno != EAGAIN) {
-		purple_debug_info("soap", "read: %s\n", g_strerror(perrno));
 		/* It's possible msn_soap_process closed the ssl connection */
 		if (conn->ssl) {
 			purple_ssl_close(conn->ssl);