From 7a7855e2879922b371597b25c27fd97d79dd165a Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 1 Dec 2003 22:47:07 +0000 Subject: Use fcntl() to set FD_CLOEXEC on each fd rather than close()ing it. 2003-12-01 Jeffrey Stedfast * mail-config.c (mail_config_signature_run_script): Use fcntl() to set FD_CLOEXEC on each fd rather than close()ing it. Apparently Linux's older pthread implementations use sockets and so this fouls threading up. GO LINUX! GO! svn path=/trunk/; revision=23548 --- mail/mail-config.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'mail/mail-config.c') diff --git a/mail/mail-config.c b/mail/mail-config.c index dfb9be8f1f..4e64adbe06 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -1430,14 +1430,11 @@ mail_config_signature_run_script (gchar *script) setsid (); maxfd = sysconf (_SC_OPEN_MAX); - if (maxfd > 0) { - for (i = 0; i < maxfd; i++) { - if (i != STDIN_FILENO && i != STDOUT_FILENO && i != STDERR_FILENO) - close (i); - } + for (i = 3; i < maxfd; i++) { + if (i != STDIN_FILENO && i != STDOUT_FILENO && i != STDERR_FILENO) + fcntl (i, F_SETFD, FD_CLOEXEC); } - execlp (script, script, NULL); g_warning ("Could not execute %s: %s\n", script, g_strerror (errno)); _exit (255); -- cgit v1.2.3