代码拉取完成,页面将自动刷新
From 05a06e34ac8a38c1cff2a08ba071386141e0b78d Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Mon, 13 Mar 2023 14:32:20 +0100
Subject: [PATCH] journald-server: always touch state file in signal handler
`journalctl --relinquish-var` waits on that file, so we must create if
even if nothing has really happened.
RHEL-only
Related: #2176892
---
src/journal/journald-server.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index aa70db95cc..4788ff78bb 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1259,8 +1259,6 @@ static int dispatch_sigrtmin1(sd_event_source *es, const struct signalfd_siginfo
}
static void relinquish_var(Server *s) {
- int r;
-
assert(s);
if (s->storage == STORAGE_NONE)
@@ -1278,15 +1276,15 @@ static void relinquish_var(Server *s) {
if (unlink("/run/systemd/journal/flushed") < 0 && errno != ENOENT)
log_warning_errno(errno, "Failed to unlink /run/systemd/journal/flushed, ignoring: %m") ;
- r = write_timestamp_file_atomic("/run/systemd/journal/relinquished", now(CLOCK_MONOTONIC));
- if (r < 0)
- log_warning_errno(r, "Failed to write /run/systemd/journal/relinquished, ignoring: %m");
+ /* NOTE: We don't create our own state file here, because dispatch_sigrtmin2() has to do it anyway.
+ * But if this function is ever called from another place, the creation must be done here too. */
return;
}
static int dispatch_sigrtmin2(sd_event_source *es, const struct signalfd_siginfo *si, void *userdata) {
Server *s = userdata;
+ int r;
assert(s);
assert(si);
@@ -1295,6 +1293,10 @@ static int dispatch_sigrtmin2(sd_event_source *es, const struct signalfd_siginfo
relinquish_var(s);
+ r = write_timestamp_file_atomic("/run/systemd/journal/relinquished", now(CLOCK_MONOTONIC));
+ if (r < 0)
+ log_warning_errno(r, "Failed to write /run/systemd/journal/relinquished, ignoring: %m");
+
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。