]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: don't bother with seqnum file if we don't read form /dev/kmsg anyway
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Nov 2019 14:21:06 +0000 (15:21 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 31 Jan 2020 14:00:33 +0000 (15:00 +0100)
src/journal/journald-kmsg.c

index 0f4d7704b26ae5d263d900fe3879ab86ba800a60..f1e9dee38e724e97f8be41ab9839338a4dd019f3 100644 (file)
@@ -416,15 +416,17 @@ fail:
 }
 
 int server_open_kernel_seqnum(Server *s) {
-        _cleanup_close_ int fd;
+        _cleanup_close_ int fd = -1;
         uint64_t *p;
         int r;
 
         assert(s);
 
-        /* We store the seqnum we last read in an mmaped file. That
-         * way we can just use it like a variable, but it is
-         * persistent and automatically flushed at reboot. */
+        /* We store the seqnum we last read in an mmaped file. That way we can just use it like a variable,
+         * but it is 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);
         if (fd < 0) {