richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
0b2ce7
From 47cc8f7e1d153e576f146d309b4043739997a673 Mon Sep 17 00:00:00 2001
0b2ce7
From: David Tardon <dtardon@redhat.com>
0b2ce7
Date: Mon, 13 Mar 2023 14:22:28 +0100
0b2ce7
Subject: [PATCH] journald-server: always create state file in signal handler
0b2ce7
0b2ce7
`journalctl --flush` waits on that file, so we must create if even if
0b2ce7
nothing has really happened.
0b2ce7
0b2ce7
RHEL-only
0b2ce7
0b2ce7
Resolves: #2174645
0b2ce7
---
0b2ce7
 src/journal/journald-server.c | 5 +++++
0b2ce7
 1 file changed, 5 insertions(+)
0b2ce7
0b2ce7
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
0b2ce7
index 279a32768c..c72cb68095 100644
0b2ce7
--- a/src/journal/journald-server.c
0b2ce7
+++ b/src/journal/journald-server.c
0b2ce7
@@ -1188,6 +1188,7 @@ int server_process_datagram(sd_event_source *es, int fd, uint32_t revents, void
0b2ce7
 
0b2ce7
 static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo *si, void *userdata) {
0b2ce7
         Server *s = userdata;
0b2ce7
+        int r;
0b2ce7
 
0b2ce7
         assert(s);
0b2ce7
 
0b2ce7
@@ -1197,6 +1198,10 @@ static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo *
0b2ce7
         server_sync(s);
0b2ce7
         server_vacuum(s, false);
0b2ce7
 
0b2ce7
+        r = touch("/run/systemd/journal/flushed");
0b2ce7
+        if (r < 0)
0b2ce7
+                log_warning_errno(r, "Failed to touch /run/systemd/journal/flushed, ignoring: %m");
0b2ce7
+
0b2ce7
         server_space_usage_message(s, NULL);
0b2ce7
         return 0;
0b2ce7
 }