diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-08-21 01:29:17 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-08-21 01:29:17 +0200 |
commit | 89fef99014662a5a63e7deaedd6292b7fb4ab2f8 (patch) | |
tree | 3482b20354f36b0a8874f27a9c115dad9ce2d6c0 /src/journal/journald.c | |
parent | c05276f23e216a706936f1ee45a7005f86b3599c (diff) |
journal: automatically evolve FSS key even when nothing is logged
Diffstat (limited to 'src/journal/journald.c')
-rw-r--r-- | src/journal/journald.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c index 7b3b6471de..f2dd4050b6 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -48,6 +48,7 @@ #include "journal-rate-limit.h" #include "journal-internal.h" #include "journal-vacuum.h" +#include "journal-authenticate.h" #include "conf-parser.h" #include "journald.h" #include "virt.h" @@ -2969,8 +2970,26 @@ int main(int argc, char *argv[]) { for (;;) { struct epoll_event event; + int t; - r = epoll_wait(server.epoll_fd, &event, 1, -1); +#ifdef HAVE_GCRYPT + usec_t u; + + if (server.system_journal && + journal_file_next_evolve_usec(server.system_journal, &u)) { + usec_t n; + + n = now(CLOCK_MONOTONIC); + + if (n >= u) + t = 0; + else + t = (int) ((u - n + USEC_PER_MSEC - 1) / USEC_PER_MSEC); + } else +#endif + t = -1; + + r = epoll_wait(server.epoll_fd, &event, 1, t); if (r < 0) { if (errno == EINTR) @@ -2979,14 +2998,20 @@ int main(int argc, char *argv[]) { log_error("epoll_wait() failed: %m"); r = -errno; goto finish; - } else if (r == 0) - break; + } - r = process_event(&server, &event); - if (r < 0) - goto finish; - else if (r == 0) - break; + if (r > 0) { + r = process_event(&server, &event); + if (r < 0) + goto finish; + else if (r == 0) + break; + } + +#ifdef HAVE_GCRYPT + if (server.system_journal) + journal_file_maybe_append_tag(server.system_journal, 0); +#endif } log_debug("systemd-journald stopped as pid %lu", (unsigned long) getpid()); |