diff --git a/src/ifset.c b/src/ifset.c index ea13340..352d94e 100644 --- a/src/ifset.c +++ b/src/ifset.c @@ -110,16 +110,11 @@ static ssize_t rtnl_do_send(int fd, const uint8_t *sbuf, size_t slen, .msg_iov = &iov, .msg_iovlen = 1, }; - retry_recv: - r = recvmsg(fd, &msg, 0); + r = safe_recvmsg(fd, &msg, 0); if (r < 0) { - if (errno == EINTR) - goto retry_recv; - else { - log_error("%s: (%s) netlink recvmsg failed: %s", - client_config.interface, fnname, strerror(errno)); - return -1; - } + log_error("%s: (%s) netlink recvmsg failed: %s", + client_config.interface, fnname, strerror(errno)); + return -1; } if (msg.msg_flags & MSG_TRUNC) { log_error("%s: (%s) Buffer not long enough for message.", diff --git a/src/nl.c b/src/nl.c index ddc4568..45e2666 100644 --- a/src/nl.c +++ b/src/nl.c @@ -95,16 +95,12 @@ ssize_t nl_recv_buf(int fd, char *buf, size_t blen) .msg_iovlen = 1, }; ssize_t ret; - retry: - ret = recvmsg(fd, &msg, MSG_DONTWAIT); + ret = safe_recvmsg(fd, &msg, MSG_DONTWAIT); if (ret < 0) { - if (errno == EINTR) - goto retry; - if (errno != EAGAIN && errno != EWOULDBLOCK) { - log_error("%s: recvmsg failed: %s", __func__, strerror(errno)); - return -1; - } - return 0; + if (errno == EAGAIN || errno == EWOULDBLOCK) + return 0; + log_error("%s: recvmsg failed: %s", __func__, strerror(errno)); + return -1; } if (msg.msg_flags & MSG_TRUNC) { log_error("%s: Buffer not long enough for message.", __func__); diff --git a/src/sockd.c b/src/sockd.c index 4b6d02b..8e0bf1d 100644 --- a/src/sockd.c +++ b/src/sockd.c @@ -88,14 +88,11 @@ int request_sockd_fd(char *buf, size_t buflen, char *response) .msg_control = control, .msg_controllen = sizeof control }; - retry: - r = recvmsg(sockdSock[0], &msg, 0); + r = safe_recvmsg(sockdSock[0], &msg, 0); if (r == 0) { suicide("%s: (%s) recvmsg received EOF", client_config.interface, __func__); } else if (r < 0) { - if (errno == EINTR) - goto retry; suicide("%s: (%s) recvmsg failed: %s", client_config.interface, __func__, strerror(errno)); }