3 Star 0 Fork 0

src-oepkgs/vhostmd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0017-vhostmd-Check-for-valide-file-handle-before-calling-.patch 982 Bytes
一键复制 编辑 原始数据 按行查看 历史
张一诺 提交于 2022-12-23 17:33 . 1.1
From d86c51d98ce8b891f3948f8aa54fc9634e6a8c67 Mon Sep 17 00:00:00 2001
From: Jim Fehlig <[email protected]>
Date: Tue, 14 Jan 2020 16:04:09 -0700
Subject: [PATCH 17/19] vhostmd: Check for valide file handle before calling
close
From coverity scan
vhostmd-1.1/vhostmd/vhostmd.c:778: var_tested_neg: Assigning: "fd" = a negative value.
vhostmd-1.1/vhostmd/vhostmd.c:845: negative_returns: "fd" is passed to a parameter that cannot be negative.
843| free(dir);
844| free(buf);
845|-> close(fd);
846| return -1;
847| }
Signed-off-by: Jim Fehlig <[email protected]>
---
vhostmd/vhostmd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c
index 1600a87..1395bc5 100644
--- a/vhostmd/vhostmd.c
+++ b/vhostmd/vhostmd.c
@@ -860,7 +860,8 @@ static int metrics_disk_create(void)
error:
free(dir);
free(buf);
- close(fd);
+ if (fd != -1)
+ close(fd);
return -1;
}
--
2.32.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-oepkgs/vhostmd.git
[email protected]:src-oepkgs/vhostmd.git
src-oepkgs
vhostmd
vhostmd
master

搜索帮助