From 51d9d699fd6ea1da04af9e70b1e624eeaa99659f Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 14 Mar 2012 14:55:35 -0400 Subject: [PATCH] Fix: sendmsg should retry on EINTR, and use MSG_NOSIGNAL Signed-off-by: Mathieu Desnoyers --- liblttng-ust-comm/lttng-ust-comm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c index b90f5fe7..2332dbf1 100644 --- a/liblttng-ust-comm/lttng-ust-comm.c +++ b/liblttng-ust-comm/lttng-ust-comm.c @@ -284,7 +284,9 @@ ssize_t ustcomm_send_unix_sock(int sock, void *buf, size_t len) * by ignoring SIGPIPE, but we don't have this luxury on the * libust side. */ - ret = sendmsg(sock, &msg, MSG_NOSIGNAL); + do { + ret = sendmsg(sock, &msg, MSG_NOSIGNAL); + } while (ret < 0 && errno == EINTR); if (ret < 0 && errno != EPIPE) { perror("sendmsg"); } @@ -347,7 +349,9 @@ ssize_t ustcomm_send_fds_unix_sock(int sock, void *buf, int *fds, size_t nb_fd, msg.msg_iov = iov; msg.msg_iovlen = 1; - ret = sendmsg(sock, &msg, 0); + do { + ret = sendmsg(sock, &msg, MSG_NOSIGNAL); + } while (ret < 0 && errno == EINTR); if (ret < 0 && errno != EPIPE) { perror("sendmsg"); } -- 2.34.1