Fix: sendmsg should retry on EINTR, and use MSG_NOSIGNAL
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 14 Mar 2012 18:55:35 +0000 (14:55 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 14 Mar 2012 18:55:35 +0000 (14:55 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-comm/lttng-ust-comm.c

index b90f5fe7baa0f64f8374bed6e367d96939baa312..2332dbf1a383d2b2b6e1500fb604039e53ab72e9 100644 (file)
@@ -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");
        }
This page took 0.025015 seconds and 4 git commands to generate.