Index: camel/camel-filter-driver.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-filter-driver.c,v
retrieving revision 1.96
diff -u -p -r1.96 camel-filter-driver.c
--- camel/camel-filter-driver.c	12 Apr 2006 19:14:13 -0000	1.96
+++ camel/camel-filter-driver.c	28 Aug 2006 13:24:10 -0000
@@ -686,6 +686,9 @@ child_setup_func (gpointer user_data)
 typedef struct {
 	gint child_status;
 	GMainLoop *loop;
+	int fd_in;
+	int fd_out;
+	int fd_err;
 } child_watch_data_t;
 
 static void
@@ -699,6 +702,15 @@ child_watch (GPid     pid,
 
 	child_watch_data->child_status = status;
 
+	if (child_watch_data->fd_in != -1)
+		close (child_watch_data->fd_in);
+
+	if (child_watch_data->fd_out != -1)
+		close (child_watch_data->fd_out);
+
+	if (child_watch_data->fd_err != -1)
+		close (child_watch_data->fd_err);
+
 	g_main_loop_quit (child_watch_data->loop);
 }
 
@@ -803,6 +815,9 @@ pipe_to_system (struct _ESExp *f, int ar
 	
  wait:
 	child_watch_data.loop = g_main_loop_new (g_main_context_new (), FALSE);
+	child_watch_data.fd_in = pipe_to_child;
+	child_watch_data.fd_out = pipe_from_child;
+	child_watch_data.fd_err = -1;
 
 	source = g_child_watch_source_new (child_pid);
 	g_source_set_callback (source, (GSourceFunc) child_watch, &child_watch_data, NULL);
Index: camel/camel-filter-search.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-filter-search.c,v
retrieving revision 1.54
diff -u -p -r1.54 camel-filter-search.c
--- camel/camel-filter-search.c	20 Apr 2006 17:52:34 -0000	1.54
+++ camel/camel-filter-search.c	28 Aug 2006 13:24:10 -0000
@@ -521,6 +521,9 @@ child_setup_func (gpointer user_data)
 typedef struct {
 	gint child_status;
 	GMainLoop *loop;
+	int fd_in;
+	int fd_out;
+	int fd_err;
 } child_watch_data_t;
 
 static void
@@ -534,6 +537,15 @@ child_watch (GPid     pid,
 
 	child_watch_data->child_status = status;
 
+	if (child_watch_data->fd_in != -1)
+		close (child_watch_data->fd_in);
+
+	if (child_watch_data->fd_out != -1)
+		close (child_watch_data->fd_out);
+
+	if (child_watch_data->fd_err != -1)
+		close (child_watch_data->fd_err);
+
 	g_main_loop_quit (child_watch_data->loop);
 }
 
@@ -591,6 +603,9 @@ run_command (struct _ESExp *f, int argc,
 	camel_object_unref (stream);
 	
 	child_watch_data.loop = g_main_loop_new (g_main_context_new (), FALSE);
+	child_watch_data.fd_in = pipe_to_child;	
+	child_watch_data.fd_out = -1;
+	child_watch_data.fd_err = -1;
 
 	source = g_child_watch_source_new (child_pid);
 	g_source_set_callback (source, (GSourceFunc) child_watch, &child_watch_data, NULL);
