From: Mathieu Desnoyers Date: Mon, 22 Aug 2011 15:14:43 +0000 (-0400) Subject: Set SOCK_CLOEXEC on socket connected to X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=204d45df751cfc84133317c88bc6c46e0de12b52;p=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 e370fcd..53e7462 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;