1 Star 0 Fork 50

zhongling.h/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
10000-core-fix-a-null-reference-case-in-load_from_path.patch 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
庞庆 提交于 2022-04-19 15:08 . Add optimized patches
From 11e4aae398f9d26c7c4e54bfa6621f80a3ed2100 Mon Sep 17 00:00:00 2001
From: Wen Yang <[email protected]>
Date: Tue, 19 Apr 2022 11:04:47 +0800
Subject: [PATCH] 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 c0b1fd4..f59a040 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -4477,7 +4477,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
@@ -4486,7 +4485,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.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhonglingh/systemd.git
[email protected]:zhonglingh/systemd.git
zhonglingh
systemd
systemd
a8

搜索帮助