diff libpurple/dnssrv.c @ 21209:975691a8d718

merge of '7ad0c13aa61f79d4ac1cfaf922642b4b63ebc914' and 'c4c1aaf98e7151d26c98319886253eaa74d317bd'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 03 Oct 2007 05:41:55 +0000
parents 4604cad304cb
children bfe1854bbf87
line wrap: on
line diff
--- a/libpurple/dnssrv.c	Wed Sep 19 13:37:35 2007 +0000
+++ b/libpurple/dnssrv.c	Wed Oct 03 05:41:55 2007 +0000
@@ -69,6 +69,7 @@
 	char *error_message;
 	GSList *results;
 #else
+	int fd_in, fd_out;
 	pid_t pid;
 #endif
 };
@@ -112,8 +113,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));
 
@@ -179,6 +183,9 @@
 		ret = g_list_remove(ret, ret->data);
 	}
 
+	close(out);
+	close(in);
+
 	_exit(0);
 }
 
@@ -358,6 +365,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);
@@ -414,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);
 }