aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-05-24 00:53:24 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-05-24 00:53:24 +0800
commit72df58400acdd6df7ecaaf91435f40f759ed9676 (patch)
treee5bf9841ab99634e92705744c1f5d36eea5d6d9a
parent14996cd9a0545230d4cd35b85d15a40521c24d19 (diff)
downloadgsoc2013-empathy-72df58400acdd6df7ecaaf91435f40f759ed9676.tar
gsoc2013-empathy-72df58400acdd6df7ecaaf91435f40f759ed9676.tar.gz
gsoc2013-empathy-72df58400acdd6df7ecaaf91435f40f759ed9676.tar.bz2
gsoc2013-empathy-72df58400acdd6df7ecaaf91435f40f759ed9676.tar.lz
gsoc2013-empathy-72df58400acdd6df7ecaaf91435f40f759ed9676.tar.xz
gsoc2013-empathy-72df58400acdd6df7ecaaf91435f40f759ed9676.tar.zst
gsoc2013-empathy-72df58400acdd6df7ecaaf91435f40f759ed9676.zip
Add CLOEXEC flag on BaconMessageConnection FD. Fixes bug #533840.
svn path=/trunk/; revision=1124
-rw-r--r--src/bacon-message-connection.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/bacon-message-connection.c b/src/bacon-message-connection.c
index c755cd5d2..c9fda4aeb 100644
--- a/src/bacon-message-connection.c
+++ b/src/bacon-message-connection.c
@@ -101,8 +101,18 @@ static gboolean server_cb (GIOChannel *source,
static gboolean
setup_connection (BaconMessageConnection *conn)
{
+ int fdflags;
+
g_return_val_if_fail (conn->chan == NULL, FALSE);
+ /* Add CLOEXEC flag on the fd to make sure the socket get closed
+ * if exec is called. */
+ fdflags = fcntl (conn->fd, F_GETFD, 0);
+ if (fdflags >= 0) {
+ fdflags |= FD_CLOEXEC;
+ fcntl (conn->fd, F_SETFD, fdflags);
+ }
+
conn->chan = g_io_channel_unix_new (conn->fd);
if (!conn->chan) {
return FALSE;
@@ -269,9 +279,7 @@ try_server (BaconMessageConnection *conn)
}
listen (conn->fd, 5);
- if (!setup_connection (conn))
- return FALSE;
- return TRUE;
+ return setup_connection (conn);
}
static gboolean