From: Mathieu Desnoyers Date: Tue, 6 Mar 2012 23:16:12 +0000 (-0500) Subject: Fix: recvmsg should handle EINTR X-Git-Tag: v2.0.0-rc3~11 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=91fe73e226b96814add53efc5c3e37b54452c68c;p=lttng-tools.git Fix: recvmsg should handle EINTR Acked-by: David Goulet Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/sessiond-comm/sessiond-comm.c b/src/common/sessiond-comm/sessiond-comm.c index 61f4ed52b..e767c5c23 100644 --- a/src/common/sessiond-comm/sessiond-comm.c +++ b/src/common/sessiond-comm/sessiond-comm.c @@ -267,7 +267,9 @@ ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len) msg.msg_iov = iov; msg.msg_iovlen = 1; - ret = recvmsg(sock, &msg, MSG_WAITALL); + do { + ret = recvmsg(sock, &msg, MSG_WAITALL); + } while (ret < 0 && errno == EINTR); if (ret < 0) { PERROR("recvmsg"); } @@ -405,7 +407,9 @@ ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd) msg.msg_control = recv_fd; msg.msg_controllen = sizeof(recv_fd); - ret = recvmsg(sock, &msg, 0); + do { + ret = recvmsg(sock, &msg, 0); + } while (ret < 0 && errno == EINTR); if (ret < 0) { PERROR("recvmsg fds"); goto end; @@ -532,7 +536,9 @@ ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len, msg.msg_controllen = sizeof(anc_buf); #endif /* __linux__ */ - ret = recvmsg(sock, &msg, 0); + do { + ret = recvmsg(sock, &msg, 0); + } while (ret < 0 && errno == EINTR); if (ret < 0) { PERROR("recvmsg fds"); goto end;