1 Star 0 Fork 38

CodeX/iproute

forked from src-openEuler/iproute 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bugfix-iproute2-3.10.0-fix-maddr-show.patch 962 Bytes
一键复制 编辑 原始数据 按行查看 历史
njlzk 提交于 2020-01-20 22:46 . bugfix
From 9b190596f7d26ad640bd3e56b65c3fedf80d3963 Mon Sep 17 00:00:00 2001
From: Feilong Lin <linfeilong@huawei.com>
Date: Mon, 20 Jan 2020 23:21:25 +0800
Subject: [PATCH] fix maddr show
---
ip/ipmaddr.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c
index 3400e05..e37929e 100644
--- a/ip/ipmaddr.c
+++ b/ip/ipmaddr.c
@@ -138,9 +138,11 @@ static void read_igmp(struct ma_info **result_p)
while (fgets(buf, sizeof(buf), fp)) {
struct ma_info *ma;
+ int index;
if (buf[0] != '\t') {
size_t len;
+ memset(&m.name, 0, sizeof(m.name));
sscanf(buf, "%d%s", &m.index, m.name);
len = strlen(m.name);
if (m.name[len - 1] == ':')
@@ -148,6 +150,10 @@ static void read_igmp(struct ma_info **result_p)
continue;
}
+ index = strlen(m.name) - 1;
+ if (index > 0 && m.name[index] == ':') {
+ m.name[index] = 0;
+ }
if (filter.dev && strcmp(filter.dev, m.name))
continue;
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/my_code_x/iproute.git
git@gitee.com:my_code_x/iproute.git
my_code_x
iproute
iproute
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385