From: Jérémie Galarneau Date: Thu, 6 Aug 2015 01:26:34 +0000 (-0400) Subject: Fix: Use MSG_NOSIGNAL when calling sendmsg() X-Git-Tag: v2.8.0-rc1~520 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=fbe49b3b8c9dc03d99441f68dfb8bcf7450d71e3;p=lttng-tools.git Fix: Use MSG_NOSIGNAL when calling sendmsg() Applications using the liblttng-ctl library are most probably not expecting the SIGPIPE signal which can be triggered by sendmsg() on a closed socket. Use the MSG_NOSIGNAL flag to handle such cases gracefully. Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/sessiond-comm/unix.c b/src/common/sessiond-comm/unix.c index 97537c538..a66bb750a 100644 --- a/src/common/sessiond-comm/unix.c +++ b/src/common/sessiond-comm/unix.c @@ -173,7 +173,7 @@ ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len) do { len_last = iov[0].iov_len; - ret = recvmsg(sock, &msg, 0); + ret = recvmsg(sock, &msg, MSG_NOSIGNAL); if (ret > 0) { iov[0].iov_base += ret; iov[0].iov_len -= ret;