From 91fe73e226b96814add53efc5c3e37b54452c68c Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 6 Mar 2012 18:16:12 -0500 Subject: [PATCH] Fix: recvmsg should handle EINTR Acked-by: David Goulet Signed-off-by: Mathieu Desnoyers --- src/common/sessiond-comm/sessiond-comm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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; -- 2.34.1