加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-journalctl-never-fail-at-flushing-when-the-flushed-f.patch 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
From dc331f4c9268d17a66f4393cfd0dba14c7022d41 Mon Sep 17 00:00:00 2001
From: Franck Bui <fbui@suse.com>
Date: Wed, 4 Aug 2021 11:20:07 +0200
Subject: [PATCH] journalctl: never fail at flushing when the flushed flag is
set
Even if journald was not running, flushing the volatile journal used to work if
the journal was already flushed (ie the flushed flag
/run/systemd/journald/flushed was created).
However since commit 4f413af2a0a, this behavior changed and now '--flush' fails
because it tries to contact journald without checking the presence of the
flushed flag anymore.
This patch restores the previous behavior since there's no reason to fail when
journalctl can figure out that the flush is not necessary.
(cherry picked from commit f6fca35e642a112e80cc9bddb9a2b4805ad40df2)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/dc331f4c9268d17a66f4393cfd0dba14c7022d41
---
src/journal/journalctl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index c8fb726d42..3eac97510d 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -2074,6 +2074,11 @@ static int simple_varlink_call(const char *option, const char *method) {
}
static int flush_to_var(void) {
+ if (access("/run/systemd/journal/flushed", F_OK) >= 0)
+ return 0; /* Already flushed, no need to contact journald */
+ if (errno != ENOENT)
+ return log_error_errno(errno, "Unable to check for existence of /run/systemd/journal/flushed: %m");
+
return simple_varlink_call("--flush", "io.systemd.Journal.FlushToVar");
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化