From: Mathieu Desnoyers Date: Mon, 22 Aug 2011 15:14:43 +0000 (-0400) Subject: Set SOCK_CLOEXEC on socket connected to X-Git-Tag: v1.9.1~285 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=204d45df751cfc84133317c88bc6c46e0de12b52;p=lttng-ust.git Set SOCK_CLOEXEC on socket connected to Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-sessiond-comm/lttng-sessiond-comm.c b/liblttng-sessiond-comm/lttng-sessiond-comm.c index e370fcd3..53e7462b 100644 --- a/liblttng-sessiond-comm/lttng-sessiond-comm.c +++ b/liblttng-sessiond-comm/lttng-sessiond-comm.c @@ -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;