journald: don't bother with seqnum file if we don't read form /dev/kmsg anyway

This commit is contained in:
Lennart Poettering 2019-11-22 15:21:06 +01:00
parent dbac262578
commit a2735a4549

View file

@ -416,15 +416,17 @@ fail:
} }
int server_open_kernel_seqnum(Server *s) { int server_open_kernel_seqnum(Server *s) {
_cleanup_close_ int fd; _cleanup_close_ int fd = -1;
uint64_t *p; uint64_t *p;
int r; int r;
assert(s); assert(s);
/* We store the seqnum we last read in an mmaped file. That /* We store the seqnum we last read in an mmaped file. That way we can just use it like a variable,
* way we can just use it like a variable, but it is * but it is persistent and automatically flushed at reboot. */
* persistent and automatically flushed at reboot. */
if (!s->read_kmsg)
return 0;
fd = open("/run/systemd/journal/kernel-seqnum", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644); fd = open("/run/systemd/journal/kernel-seqnum", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644);
if (fd < 0) { if (fd < 0) {