From: Matthias Clasen Date: Sun, 17 Dec 2006 17:45:03 +0000 (+0000) Subject: Fix the recent fdwalk()-related changes to not break mapping-test. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=a7d0392b4daf6b76d470652059c0820eb9d7a180;p=dana%2Fcg-glib.git Fix the recent fdwalk()-related changes to not break mapping-test. * glib/gspawn.c: Fix the recent fdwalk()-related changes to not break mapping-test. (#286838, Marco Barisione) --- diff --git a/ChangeLog b/ChangeLog index c29503bc..f34c77b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-12-17 Matthias Clasen + * glib/gspawn.c: Fix the recent fdwalk()-related changes + to not break mapping-test. (#286838, Marco Barisione) + * glib/gstring.c (g_string_chunk_new): Don't shadow size. (#386760, Kazuki IWAMOTO) diff --git a/glib/gspawn.c b/glib/gspawn.c index 9cff4ed3..33764f9c 100644 --- a/glib/gspawn.c +++ b/glib/gspawn.c @@ -853,11 +853,13 @@ write_err_and_exit (gint fd, gint msg) _exit (1); } -static void +static int set_cloexec (void *data, gint fd) { - if (fd > 2) + if (fd >= GPOINTER_TO_INT (data)) fcntl (fd, F_SETFD, FD_CLOEXEC); + + return 0; } #ifndef HAVE_FDWALK @@ -926,12 +928,12 @@ do_exec (gint child_err_report_fd, */ if (close_descriptors) { - fdwalk (set_cloexec, NULL); + fdwalk (set_cloexec, GINT_TO_POINTER(3)); } else { /* We need to do child_err_report_fd anyway */ - set_cloexec (NULL, child_err_report_fd); + set_cloexec (GINT_TO_POINTER(0), child_err_report_fd); } /* Redirect pipes as required */