naccyde / rpms / systemd

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