1 Star 0 Fork 32

fantaotao1/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0235-dfx-set-g_unix_fd-to-1-after-abnormal-close-fd-to-av.patch 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
kircher 提交于 2023-05-16 15:57 . sync add-udp-multicast-support-in-gazelle
From 1cdbc7c47200b9ffc1911656567b48f53f4107b8 Mon Sep 17 00:00:00 2001
From: jiangheng12 <jiangheng14@huawei.com>
Date: Wed, 26 Apr 2023 19:34:58 +0800
Subject: [PATCH] dfx: set g_unix_fd to -1 after abnormal close fd to avoid
double close
---
src/ltran/ltran_dfx.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index 3513125..4baca26 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -289,6 +289,7 @@ static int32_t dfx_stat_read_from_ltran(char *buf, uint32_t len, enum GAZELLE_ST
dfx = find_dfx_node(mode);
if (dfx == NULL) {
close(fd);
+ g_unix_fd = -1;
return GAZELLE_ERR;
}
@@ -297,6 +298,7 @@ static int32_t dfx_stat_read_from_ltran(char *buf, uint32_t len, enum GAZELLE_ST
if (ret == -1) {
printf("read stat response msg failed ret=%d\n", ret);
close(fd);
+ g_unix_fd = -1;
return GAZELLE_ERR;
}
}
@@ -1368,16 +1370,16 @@ int32_t main(int32_t argc, char *argv[])
int unix_arg = 0;
for (int32_t i = 1; i < argc; i++) {
- if (unix_arg == 0) {
- if (!strcmp(argv[i], "-u")) {
- unix_arg++;
- }
- } else if (unix_arg == 1) {
- g_unix_prefix = argv[i];
- unix_arg++;
- } else {
- argv[i - unix_arg] = argv[i];
- }
+ if (unix_arg == 0) {
+ if (!strcmp(argv[i], "-u")) {
+ unix_arg++;
+ }
+ } else if (unix_arg == 1) {
+ g_unix_prefix = argv[i];
+ unix_arg++;
+ } else {
+ argv[i - unix_arg] = argv[i];
+ }
}
argv[argc - unix_arg] = argv[argc];
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fantaotao1/gazelle.git
git@gitee.com:fantaotao1/gazelle.git
fantaotao1
gazelle
gazelle
master

搜索帮助