summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2007-03-02 20:05:59 +0000
committerRay Strode <halfline@src.gnome.org>2007-03-02 20:05:59 +0000
commit733bc1e72abd6d070b339fcef9ddb343ed71c2cf (patch)
treeab1d15dceecc744b4d7879282c28c33c22a7d3a6
parent3163512b9df75543ded4ce5cec0223a69a9ed191 (diff)
downloadgconf-733bc1e72abd6d070b339fcef9ddb343ed71c2cf.tar.gz
Patch from Padraig O'Briain <padraig.obriain@sun.com>
2007-03-02 Ray Strode <rstrode@redhat.com> Patch from Padraig O'Briain <padraig.obriain@sun.com> * configure.in: * gconf/gconf-internals.c (close_fd_func): use fdwalk() to only close open file descriptors if available (bug 357206) svn path=/trunk/; revision=2372
-rw-r--r--ChangeLog10
-rw-r--r--configure.in2
-rw-r--r--gconf/gconf-internals.c17
3 files changed, 28 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0bdfd400..f7ba1fda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2007-03-02 Ray Strode <rstrode@redhat.com>
+ Patch from
+ Padraig O'Briain <padraig.obriain@sun.com>
+
+ * configure.in:
+ * gconf/gconf-internals.c (close_fd_func):
+ use fdwalk() to only close open file descriptors
+ if available (bug 357206)
+
+2007-03-02 Ray Strode <rstrode@redhat.com>
+
Patch from
Paolo Borelli <pborelli@katamail.com>
diff --git a/configure.in b/configure.in
index bc1fe7fb..a5a3445f 100644
--- a/configure.in
+++ b/configure.in
@@ -179,7 +179,7 @@ AM_CONDITIONAL(PTHREADS, test -n "$have_pthreads")
AC_CHECK_HEADERS(syslog.h sys/wait.h)
-AC_CHECK_FUNCS(getuid sigaction fsync fchmod)
+AC_CHECK_FUNCS(getuid sigaction fsync fchmod fdwalk)
LDAP_LIBS=
diff --git a/gconf/gconf-internals.c b/gconf/gconf-internals.c
index 12f8f3fc..e5379c2d 100644
--- a/gconf/gconf-internals.c
+++ b/gconf/gconf-internals.c
@@ -2910,17 +2910,31 @@ gconf_get_lock_dir (void)
#if defined (F_SETFD) && defined (FD_CLOEXEC)
+#ifndef HAVE_FDWALK
static void
set_cloexec (gint fd)
{
fcntl (fd, F_SETFD, FD_CLOEXEC);
+#else
+static int
+set_cloexec (void *data, int fd)
+{
+ int *pipes = (int *)data;
+
+ if (fd != pipes[1] && fd > 2)
+ fcntl (fd, F_SETFD, FD_CLOEXEC);
+
+ return 0;
+#endif
}
+
static void
close_fd_func (gpointer data)
{
int *pipes = data;
+#ifndef HAVE_FDWALK
gint open_max;
gint i;
@@ -2931,6 +2945,9 @@ close_fd_func (gpointer data)
if (i != pipes[1])
set_cloexec (i);
}
+#else
+ (void) fdwalk(set_cloexec, (void *)pipes);
+#endif
}
#else