1 Star 0 Fork 48

Zhao Hang/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0879-pstopre-fix-return-value-of-list_files.patch 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
Zhao Hang 提交于 2023-06-19 11:02 . update to systemd-239-74.el8_8
From a0485b96118d3d2ac439f510e404ffb3db03e23f Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Mon, 22 Jul 2019 10:55:10 +0900
Subject: [PATCH] pstopre: fix return value of list_files()
Previously, the return value of the last read_full_file() is returned.
This makes the error in read_full_file() is always ignored.
(cherry picked from commit 337874a45fff46a80e4974c681a5e651f3a0fac9)
Related: #2158832
---
src/pstore/pstore.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pstore/pstore.c b/src/pstore/pstore.c
index e6a342fc50..2fbef48543 100644
--- a/src/pstore/pstore.c
+++ b/src/pstore/pstore.c
@@ -311,7 +311,7 @@ static void process_dmesg_files(PStoreList *list) {
static int list_files(PStoreList *list, const char *sourcepath) {
_cleanup_(closedirp) DIR *dirp = NULL;
struct dirent *de;
- int r = 0;
+ int r;
dirp = opendir(sourcepath);
if (!dirp)
@@ -330,7 +330,7 @@ static int list_files(PStoreList *list, const char *sourcepath) {
/* Now read contents of pstore file */
r = read_full_file(ifd_path, &buf, &buf_size);
if (r < 0) {
- log_warning_errno(r, "Failed to read file %s: %m", ifd_path);
+ log_warning_errno(r, "Failed to read file %s, skipping: %m", ifd_path);
continue;
}
@@ -346,7 +346,7 @@ static int list_files(PStoreList *list, const char *sourcepath) {
};
}
- return r;
+ return 0;
}
static int run(int argc, char *argv[]) {
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhaohang_mskdxl/systemd.git
git@gitee.com:zhaohang_mskdxl/systemd.git
zhaohang_mskdxl
systemd
systemd
a8

搜索帮助