changeset 20232:b7c0c79585f9

applied changes from 31d62e1a78974a0239e86bfeb42b29ab75216114 through c32aee6deb5c7a5e5749d6e0598f588947b8d45c
author Richard Laager <rlaager@wiktel.com>
date Fri, 28 Sep 2007 15:52:48 +0000
parents 09b4d8c32e50
children ef5cdffa31d4
files libpurple/dnssrv.c
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/dnssrv.c	Fri Sep 28 15:52:28 2007 +0000
+++ b/libpurple/dnssrv.c	Fri Sep 28 15:52:48 2007 +0000
@@ -68,6 +68,7 @@
 	char *error_message;
 	GSList *results;
 #else
+	int fd_in, fd_out;
 	pid_t pid;
 #endif
 };
@@ -111,8 +112,11 @@
 	purple_restore_default_signal_handlers();
 #endif
 
-	if (read(in, query, 256) <= 0)
+	if (read(in, query, 256) <= 0) {
+		close(out);
+		close(in);
 		_exit(0);
+	}
 
 	size = res_query( query, C_IN, T_SRV, (u_char*)&answer, sizeof( answer));
 
@@ -178,6 +182,9 @@
 		ret = g_list_remove(ret, ret->data);
 	}
 
+	close(out);
+	close(in);
+
 	_exit(0);
 }
 
@@ -357,6 +364,8 @@
 	query_data->cb = cb;
 	query_data->extradata = extradata;
 	query_data->pid = pid;
+	query_data->fd_out = out[0];
+	query_data->fd_in = in[1];
 	query_data->handle = purple_input_add(out[0], PURPLE_INPUT_READ, resolved, query_data);
 
 	g_free(query);
@@ -398,6 +407,7 @@
 void
 purple_srv_cancel(PurpleSrvQueryData *query_data)
 {
+printf("purple_srv_cancel(%p)\n", query_data);
 	if (query_data->handle > 0)
 		purple_input_remove(query_data->handle);
 #ifdef _WIN32
@@ -413,6 +423,9 @@
 	}
 	g_free(query_data->query);
 	g_free(query_data->error_message);
+#else
+	close(query_data->fd_out);
+	close(query_data->fd_in);
 #endif
 	g_free(query_data);
 }