From 57d16b05bcd7e079f794f55016821900bbaeffb3 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Tue, 18 Dec 2012 18:17:56 +0100
Subject: [PATCH] e17: Set FD_CLOEXEC correctly using F_SETFD not F_SETFL

Using that value on F_SETFL is just wrong, and might make the call fail
on some systems, as it's requesting to set an undetermined flag. For
example on GNU/* FD_CLOEXEC has value 1, which matches with O_WRONLY.

This might cause the code to at least leak file descriptors, and at worst
to terminate execution.
---
 src/modules/mixer/pa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/modules/mixer/pa.c b/src/modules/mixer/pa.c
index 544f131..e1605a6 100644
--- a/src/modules/mixer/pa.c
+++ b/src/modules/mixer/pa.c
@@ -354,7 +354,8 @@ con(Pulse *conn, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev)
    setsockopt(conn->fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
 #endif
    setsockopt(conn->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
-   fcntl(conn->fd, F_SETFL, O_NONBLOCK | FD_CLOEXEC);
+   fcntl(conn->fd, F_SETFL, O_NONBLOCK);
+   fcntl(conn->fd, F_SETFD, FD_CLOEXEC);
    conn->fdh = ecore_main_fd_handler_add(conn->fd, ECORE_FD_WRITE, (Ecore_Fd_Cb)fdh_func, conn, NULL, NULL);
    ecore_con_server_del(conn->svr);
    conn->svr = NULL;
-- 
1.8.1.rc0

