pidgin: 60045dba: Fix this g_return_val_if_fail. It shoul...
markdoliner at pidgin.im
markdoliner at pidgin.im
Wed Sep 10 18:05:41 EDT 2008
-----------------------------------------------------------------
Revision: 60045dbace89be557466fc68978290d5fe8b491d
Ancestor: 849d4f7265598a9f0340411c4c0c0401d488ec3b
Author: markdoliner at pidgin.im
Date: 2008-09-10T21:59:09
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/60045dbace89be557466fc68978290d5fe8b491d
Modified files:
libpurple/dnsquery.c
ChangeLog:
Fix this g_return_val_if_fail. It should have been returning TRUE or
FALSE and not -1. But I think it was also leaking. I made the log
message a little better, too.
-------------- next part --------------
============================================================
--- libpurple/dnsquery.c 42121cad1d9a0e892eb148e24da8f1c39f954533
+++ libpurple/dnsquery.c 2ef0daf0e832a0a89b1e954cf2ee7c45c5a0d48b
@@ -412,7 +412,7 @@ send_dns_request_to_child(PurpleDnsQuery
{
pid_t pid;
dns_params_t dns_params;
- int rc;
+ 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
@@ -444,9 +444,14 @@ send_dns_request_to_child(PurpleDnsQuery
purple_dnsquery_resolver_destroy(resolver);
return FALSE;
}
+ 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;
+ }
- g_return_val_if_fail(rc == sizeof(dns_params), -1);
-
purple_debug_info("dns",
"Successfully sent DNS request to child %d\n",
resolver->dns_pid);
More information about the Commits
mailing list