Don't leak the pipes to child processes. Patch by Thiago Macieira.
authorMatthias Clasen <matthiasc@src.gnome.org>
Fri, 13 Jun 2008 14:11:03 +0000 (14:11 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 13 Jun 2008 14:11:03 +0000 (14:11 +0000)
        * glib/gmain.c (g_main_context_init_pipe): Don't leak the
        pipes to child processes. Patch by Thiago Macieira.

svn path=/trunk/; revision=7037

ChangeLog
glib/gmain.c

index 7b1ec0353d70d2930bf2559786378d39b882b691..1b9b1a13a146fb02732894ae325aa55e003929a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-06-13  Matthias Clasen  <mclasen@redhat.com>
+
+       Bug 538119 – glib's mainloop leaks a pipe to sub-processes
+
+       * glib/gmain.c (g_main_context_init_pipe): Don't leak the
+       pipes to child processes. Patch by Thiago Macieira.
+
 2008-06-13  Hans Breuer  <hans@breuer.org>
 
        * glib/gstrfuncs.c : to get the default translation target on
index b0c274c1c02ef18d2650986d646eb581730ec8c2..b207ab7f600aff7a68cc02937ad19773c898d2bc 100644 (file)
@@ -669,7 +669,10 @@ g_main_context_init_pipe (GMainContext *context)
   if (pipe (context->wake_up_pipe) < 0)
     g_error ("Cannot create pipe main loop wake-up: %s\n",
             g_strerror (errno));
-  
+  fcntl (context->wake_up_pipe[0], F_SETFD, FD_CLOEXEC);
+  fcntl (context->wake_up_pipe[1], F_SETFD, FD_CLOEXEC);
+
   context->wake_up_rec.fd = context->wake_up_pipe[0];
   context->wake_up_rec.events = G_IO_IN;
 # else