Set SOCK_CLOEXEC on socket connected to
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 22 Aug 2011 15:14:43 +0000 (11:14 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 22 Aug 2011 15:14:43 +0000 (11:14 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-sessiond-comm/lttng-sessiond-comm.c

index e370fcd3542b9efddbbf40d90bc904f32264846d..53e7462b6461c56c2ce690baa8a0d08e75ab0d17 100644 (file)
@@ -117,7 +117,11 @@ int lttcomm_connect_unix_sock(const char *pathname)
        int fd;
        int ret;
 
-       fd = socket(PF_UNIX, SOCK_STREAM, 0);
+       /*
+        * libust threads require the close-on-exec flag for all
+        * resources so it does not leak file descriptors upon exec.
+        */
+       fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
        if (fd < 0) {
                perror("socket");
                ret = fd;
This page took 0.024457 seconds and 4 git commands to generate.