aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-12-02 06:47:07 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-12-02 06:47:07 +0800
commit7a7855e2879922b371597b25c27fd97d79dd165a (patch)
tree4774a7838009b7ae915f6c6333ea575b66efa15b
parent34ff1d48c04bd106e28477124769ca37727fe194 (diff)
downloadgsoc2013-evolution-7a7855e2879922b371597b25c27fd97d79dd165a.tar.gz
gsoc2013-evolution-7a7855e2879922b371597b25c27fd97d79dd165a.tar.zst
gsoc2013-evolution-7a7855e2879922b371597b25c27fd97d79dd165a.zip
Use fcntl() to set FD_CLOEXEC on each fd rather than close()ing it.
2003-12-01 Jeffrey Stedfast <fejj@ximian.com> * 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
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-config.c9
2 files changed, 10 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index be75dee5d6..b1a592ce5f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2003-12-01 Jeffrey Stedfast <fejj@ximian.com>
+
+ * 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!
+
2003-12-01 Rodney Dawes <dobey@ximian.com>
* GNOME_Evlution_Mail.server.in.in:
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);