Handle EINTR when sending logs to the journal

Ray pointed out that we might well get interrupted here,
and should not loose logs due to that.
This commit is contained in:
Matthias Clasen 2016-07-25 10:25:40 -04:00
parent 34cb9c7de1
commit ad285d9bd2

View File

@ -1818,9 +1818,13 @@ journal_sendv (struct iovec *iov,
mh.msg_iov = iov; mh.msg_iov = iov;
mh.msg_iovlen = iovlen; mh.msg_iovlen = iovlen;
retry:
if (sendmsg (journal_fd, &mh, MSG_NOSIGNAL) >= 0) if (sendmsg (journal_fd, &mh, MSG_NOSIGNAL) >= 0)
return 0; return 0;
if (errno == EINTR)
goto retry;
if (errno != EMSGSIZE && errno != ENOBUFS) if (errno != EMSGSIZE && errno != ENOBUFS)
return -1; return -1;
@ -1857,9 +1861,14 @@ journal_sendv (struct iovec *iov,
mh.msg_controllen = cmsg->cmsg_len; mh.msg_controllen = cmsg->cmsg_len;
(void) sendmsg (journal_fd, &mh, MSG_NOSIGNAL); retry2:
if (sendmsg (journal_fd, &mh, MSG_NOSIGNAL) >= 0)
return 0;
return 0; if (errno == EINTR)
goto retry2;
return -1;
} }
/** /**