# HG changeset patch # User Kevin Stange # Date 1221165039 0 # Node ID ec85a522b4552cd80e96837290f08e2872569ac7 # Parent d9d31ff2e7f841d428533b4169cf3b923dbad7f7# Parent 40a4e02027f44e00232b17857d79db291c9dd2d0 merge of '9eaf43035d1d4af1bc92a49bb30f637211f80123' and 'f12c8903079425d7850fa183df0b3f937b2952be' diff -r d9d31ff2e7f8 -r ec85a522b455 libpurple/dnsquery.c --- a/libpurple/dnsquery.c Thu Sep 11 20:26:21 2008 +0000 +++ b/libpurple/dnsquery.c Thu Sep 11 20:30:39 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 d9d31ff2e7f8 -r ec85a522b455 libpurple/protocols/msn/soap.c --- a/libpurple/protocols/msn/soap.c Thu Sep 11 20:26:21 2008 +0000 +++ b/libpurple/protocols/msn/soap.c Thu Sep 11 20:30:39 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);