Set SOCK_CLOEXEC on socket connected to
[lttng-ust.git] / 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.023768 seconds and 4 git commands to generate.