changeset 24081:b703102fa0a5

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.
author Mark Doliner <mark@kingant.net>
date Wed, 10 Sep 2008 21:59:09 +0000
parents 005649461c77
children ad88d875cdd8
files libpurple/dnsquery.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/dnsquery.c	Wed Sep 10 21:48:33 2008 +0000
+++ b/libpurple/dnsquery.c	Wed Sep 10 21:59:09 2008 +0000
@@ -412,7 +412,7 @@
 {
 	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,8 +444,13 @@
 		purple_dnsquery_resolver_destroy(resolver);
 		return FALSE;
 	}
-
-	g_return_val_if_fail(rc == sizeof(dns_params), -1);
+	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;
+	}
 
 	purple_debug_info("dns",
 			"Successfully sent DNS request to child %d\n",