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.5.5~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8eadb073927f4184aeb659aace661ca2cf1cb40b;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 2c87b82c4..24c7cfccd 100644 --- a/src/common/sessiond-comm/unix.c +++ b/src/common/sessiond-comm/unix.c @@ -172,7 +172,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;