From: Mathieu Desnoyers Date: Wed, 14 Mar 2012 18:55:35 +0000 (-0400) Subject: Fix: sendmsg should retry on EINTR, and use MSG_NOSIGNAL X-Git-Tag: v2.0.0-rc3~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=51d9d699fd6ea1da04af9e70b1e624eeaa99659f;p=lttng-ust.git Fix: sendmsg should retry on EINTR, and use MSG_NOSIGNAL Signed-off-by: Mathieu Desnoyers --- 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"); }