1 Star 0 Fork 97

majunqian/systemd

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-journalctl-never-fail-at-flushing-when-the-flushed-f.patch 1.44 KB
一键复制 编辑 原始数据 按行查看 历史
xujing 提交于 2022-03-23 19:22 . sync and backport some patches
From f6fca35e642a112e80cc9bddb9a2b4805ad40df2 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.
---
src/journal/journalctl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 4a2343a63d..73e4fafdff 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -2064,6 +2064,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.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/majunqian/systemd.git
git@gitee.com:majunqian/systemd.git
majunqian
systemd
systemd
master

搜索帮助