1 Star 0 Fork 49

alpha_wang/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0575-initrd-do-a-debug-log-if-etc-initrd-release-doesn-t-.patch 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
renbo02 提交于 2021-12-27 17:02 . update to systemd-239-51.el8
From a1417c121d19272b1389098648132106a5ffc661 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Thu, 14 Jan 2021 01:25:20 +0800
Subject: [PATCH] initrd: do a debug log if /etc/initrd-release doesn't take
effect
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 4a60d8cbcae574896a28f9f1f6204a1bddca8e99)
Related: #1959339
---
src/basic/util.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/basic/util.c b/src/basic/util.c
index fef52ad5ff..609f8c2f33 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -174,8 +174,17 @@ bool in_initrd(void) {
saved_in_initrd = r > 0;
}
- if (saved_in_initrd != 0)
- saved_in_initrd = access("/etc/initrd-release", F_OK) >= 0;
+ r = access("/etc/initrd-release", F_OK);
+ if (r >= 0) {
+ if (saved_in_initrd == 0)
+ log_debug("/etc/initrd-release exists, but it's not an initrd.");
+ else
+ saved_in_initrd = 1;
+ } else {
+ if (errno != ENOENT)
+ log_debug_errno(errno, "Failed to test if /etc/initrd-release exists: %m");
+ saved_in_initrd = 0;
+ }
return saved_in_initrd;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/alpha-wang/systemd.git
git@gitee.com:alpha-wang/systemd.git
alpha-wang
systemd
systemd
a8

搜索帮助

0d507c66 1850385 C8b1a773 1850385