From: Mathieu Desnoyers Date: Wed, 22 Feb 2012 22:10:27 +0000 (-0500) Subject: Revert "Use bsd-compatible fcntl for close-on-exec on socket" X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=6e07deb6f7903cb8f4f8080652af117f76a4e906;p=lttng-ust.git Revert "Use bsd-compatible fcntl for close-on-exec on socket" This reverts commit 4171df999bf0c0c552fa35cea9a12fa4d82faae6. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c index 7e55cff5..3277191c 100644 --- a/liblttng-ust-comm/lttng-ust-comm.c +++ b/liblttng-ust-comm/lttng-ust-comm.c @@ -29,7 +29,6 @@ #include #include #include -#include #include @@ -120,17 +119,12 @@ int ustcomm_connect_unix_sock(const char *pathname) * 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, 0); + fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); if (fd < 0) { perror("socket"); ret = fd; goto error; } - ret = fcntl(fd, F_SETFD, FD_CLOEXEC); - if (ret < 0) { - perror("fcntl"); - goto error_fcntl; - } memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX; @@ -150,7 +144,6 @@ int ustcomm_connect_unix_sock(const char *pathname) return fd; error_connect: -error_fcntl: close(fd); error: return ret;