X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=logger.c;h=46cce5f09d074747ac84748fd5ccd071f9d49793;hb=2fa086a8e02b1b2d62a9a424b41944f3a2251e60;hp=311458bd2660b4c3776b40f699eca3958f955530;hpb=a7334b0952ab66c17ee787e36e6d2c5ceb387de6;p=elogind.git diff --git a/logger.c b/logger.c index 311458bd2..46cce5f09 100644 --- a/logger.c +++ b/logger.c @@ -86,12 +86,6 @@ struct Stream { LIST_FIELDS(Stream, stream); }; -#define IOVEC_SET_STRING(iovec, s) \ - do { \ - (iovec).iov_base = s; \ - (iovec).iov_len = strlen(s); \ - } while(false); - static int stream_log(Stream *s, char *p, usec_t timestamp) { char header_priority[16], header_time[64], header_pid[16]; @@ -155,7 +149,7 @@ static int stream_log(Stream *s, char *p, usec_t timestamp) { IOVEC_SET_STRING(iovec[1], s->process); IOVEC_SET_STRING(iovec[2], header_pid); IOVEC_SET_STRING(iovec[3], p); - IOVEC_SET_STRING(iovec[4], "\n"); + IOVEC_SET_STRING(iovec[4], (char*) "\n"); if (writev(s->server->kmsg_fd, iovec, ELEMENTSOF(iovec)) < 0) return -errno; @@ -548,9 +542,9 @@ int main(int argc, char *argv[]) { for (;;) { struct epoll_event event; - int n; + int k; - if ((n = epoll_wait(server.epoll_fd, + if ((k = epoll_wait(server.epoll_fd, &event, 1, server.n_streams <= 0 ? TIMEOUT : -1)) < 0) { @@ -561,10 +555,10 @@ int main(int argc, char *argv[]) { goto fail; } - if (n <= 0) + if (k <= 0) break; - if ((r = process_event(&server, &event)) < 0) + if ((k = process_event(&server, &event)) < 0) goto fail; } r = 0;