1 Star 0 Fork 30

znzjugod/rasdaemon

forked from src-openEuler/rasdaemon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-rasdaemon-use-standard-length-PATH_MAX-for-path-name.patch 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
From: Xiaofei Tan <tanxiaofei@huawei.com>
Date: Sat, 20 Aug 2022 09:49:25 +0000
Subject: [PATCH] rasdaemon: use standard length PATH_MAX for path name
Use standard length PATH_MAX for path name space allocation
to replace the macro MAX_PATH_LEN.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
ras-cpu-isolation.c | 6 +++---
ras-cpu-isolation.h | 1 -
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/ras-cpu-isolation.c b/ras-cpu-isolation.c
index ba5ccd1..24c07e9 100644
--- a/ras-cpu-isolation.c
+++ b/ras-cpu-isolation.c
@@ -80,11 +80,11 @@ static const char * const cpu_state[] = {
static int open_sys_file(unsigned int cpu, int __oflag, const char *format)
{
int fd;
- char path[MAX_PATH_LEN + 1] = "";
- char real_path[MAX_PATH_LEN + 1] = "";
+ char path[PATH_MAX] = "";
+ char real_path[PATH_MAX] = "";
snprintf(path, sizeof(path), format, cpu);
- if (strlen(path) > MAX_PATH_LEN || realpath(path, real_path) == NULL) {
+ if (strlen(path) > PATH_MAX || realpath(path, real_path) == NULL) {
log(TERM, LOG_ERR, "[%s]:open file: %s failed\n", __func__, path);
return -1;
}
diff --git a/ras-cpu-isolation.h b/ras-cpu-isolation.h
index 024a68b..5682106 100644
--- a/ras-cpu-isolation.h
+++ b/ras-cpu-isolation.h
@@ -17,7 +17,6 @@
#include "queue.h"
-#define MAX_PATH_LEN 100
#define MAX_BUF_LEN 1024
struct param {
--
2.17.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/znzjugod/rasdaemon.git
git@gitee.com:znzjugod/rasdaemon.git
znzjugod
rasdaemon
rasdaemon
master

搜索帮助