1 Star 0 Fork 51

庞庆/systemd_1

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1001-core-fix-a-null-reference-case-in-load_from_path.patch 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
杨枝甘露瑞纳冰 提交于 2021-12-14 15:45 +08:00 . Add optimized patches
From 3262f6c71165c309605dd87c88c7daf7dd300e6f Mon Sep 17 00:00:00 2001
From: Wen Yang <wenyang@linux.alibaba.com>
Date: Mon, 1 Jun 2020 17:06:53 +0800
Subject: [PATCH] core: fix a null reference case in load_from_path()
---
src/core/load-fragment.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 33fdb82754..be5d3c2816 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -4415,7 +4415,6 @@ static int load_from_path(Unit *u, const char *path) {
r = open_follow(&filename, &f, symlink_names, &id);
if (r >= 0)
break;
- filename = mfree(filename);
/* ENOENT means that the file is missing or is a dangling symlink.
* ENOTDIR means that one of paths we expect to be is a directory
@@ -4424,7 +4423,8 @@ static int load_from_path(Unit *u, const char *path) {
*/
if (r == -EACCES)
log_debug_errno(r, "Cannot access \"%s\": %m", filename);
- else if (!IN_SET(r, -ENOENT, -ENOTDIR))
+ filename = mfree(filename);
+ if (!IN_SET(r, -ENOENT, -ENOTDIR))
return r;
/* Empty the symlink names for the next run */
--
2.18.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pang-qing/systemd_1.git
git@gitee.com:pang-qing/systemd_1.git
pang-qing
systemd_1
systemd_1
a8

搜索帮助