代码拉取完成,页面将自动刷新
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。