libbacon r112 - trunk/src
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: libbacon r112 - trunk/src
- Date: Fri, 23 May 2008 16:51:13 +0000 (UTC)
Author: xclaesse
Date: Fri May 23 16:51:13 2008
New Revision: 112
URL: http://svn.gnome.org/viewvc/libbacon?rev=112&view=rev
Log:
Add FD_CLOEXEC flag on conn->fd to make sure the FD is closed if exec is called. Fix bug #533840.
Modified:
trunk/src/bacon-message-connection.c
Modified: trunk/src/bacon-message-connection.c
==============================================================================
--- trunk/src/bacon-message-connection.c (original)
+++ trunk/src/bacon-message-connection.c Fri May 23 16:51:13 2008
@@ -101,8 +101,18 @@
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 @@
}
listen (conn->fd, 5);
- if (!setup_connection (conn))
- return FALSE;
- return TRUE;
+ return setup_connection (conn);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]