From 4c78992dbf2244577bc2487c7606b6b0f0bf242c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 13 Jun 2008 14:11:03 +0000 Subject: [PATCH] Don't leak the pipes to child processes. Patch by Thiago Macieira. * 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 | 7 +++++++ glib/gmain.c | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7b1ec0353..1b9b1a13a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-13 Matthias Clasen + + 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 * glib/gstrfuncs.c : to get the default translation target on diff --git a/glib/gmain.c b/glib/gmain.c index b0c274c1c..b207ab7f6 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -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