From fbe49b3b8c9dc03d99441f68dfb8bcf7450d71e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 5 Aug 2015 21:26:34 -0400 Subject: [PATCH] Fix: Use MSG_NOSIGNAL when calling sendmsg() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/common/sessiond-comm/unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.34.1