# HG changeset patch # User Kevin Stange # Date 1221166695 0 # Node ID d31ceef11df1dd9e9d351ab5152f538f02765d2c # Parent dc25ef2669f69ae41623d95f6185ca88c38d308c# Parent ec85a522b4552cd80e96837290f08e2872569ac7 merge of 'aaddbdd76370264a6f95b6d787b565061e3b40d6' and 'ab9a8e940ca290009deae6e3044bc352a0cd9223' diff -r dc25ef2669f6 -r d31ceef11df1 libpurple/dnsquery.c --- 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; } diff -r dc25ef2669f6 -r d31ceef11df1 libpurple/protocols/msn/soap.c --- 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);