teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0903-journald-server-move-relinquish-code-into-function.patch

6f381c
From 7a7b0c4ec7a5595a44d9c70d8270b0724a8b8c45 Mon Sep 17 00:00:00 2001
6f381c
From: David Tardon <dtardon@redhat.com>
6f381c
Date: Mon, 13 Mar 2023 14:31:38 +0100
6f381c
Subject: [PATCH] journald-server: move relinquish code into function
6f381c
6f381c
No functional change, just refactoring.
6f381c
6f381c
RHEL-only
6f381c
6f381c
Related: #2174645
6f381c
---
6f381c
 src/journal/journald-server.c | 23 ++++++++++++++++-------
6f381c
 1 file changed, 16 insertions(+), 7 deletions(-)
6f381c
6f381c
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
6f381c
index c72cb68095..aa70db95cc 100644
6f381c
--- a/src/journal/journald-server.c
6f381c
+++ b/src/journal/journald-server.c
6f381c
@@ -1258,20 +1258,16 @@ static int dispatch_sigrtmin1(sd_event_source *es, const struct signalfd_siginfo
6f381c
         return 0;
6f381c
 }
6f381c
 
6f381c
-
6f381c
-static int dispatch_sigrtmin2(sd_event_source *es, const struct signalfd_siginfo *si, void *userdata) {
6f381c
-        Server *s = userdata;
6f381c
+static void relinquish_var(Server *s) {
6f381c
         int r;
6f381c
 
6f381c
         assert(s);
6f381c
 
6f381c
         if (s->storage == STORAGE_NONE)
6f381c
-                return 0;
6f381c
+                return;
6f381c
 
6f381c
         if (s->runtime_journal && !s->system_journal)
6f381c
-                return 0;
6f381c
-
6f381c
-        log_debug("Received request to relinquish /var from PID " PID_FMT, si->ssi_pid);
6f381c
+                return;
6f381c
 
6f381c
         (void) system_journal_open(s, false, true);
6f381c
 
6f381c
@@ -1286,6 +1282,19 @@ static int dispatch_sigrtmin2(sd_event_source *es, const struct signalfd_siginfo
6f381c
         if (r < 0)
6f381c
                 log_warning_errno(r, "Failed to write /run/systemd/journal/relinquished, ignoring: %m");
6f381c
 
6f381c
+        return;
6f381c
+}
6f381c
+
6f381c
+static int dispatch_sigrtmin2(sd_event_source *es, const struct signalfd_siginfo *si, void *userdata) {
6f381c
+        Server *s = userdata;
6f381c
+
6f381c
+        assert(s);
6f381c
+        assert(si);
6f381c
+
6f381c
+        log_debug("Received request to relinquish /var from PID " PID_FMT, si->ssi_pid);
6f381c
+
6f381c
+        relinquish_var(s);
6f381c
+
6f381c
         return 0;
6f381c
 }
6f381c