fix ifconfig display error when the length of interface name is 15

(cherry picked from commit c5e9be42e02d9fd08a94c4b170a6927aaa414bbd)
This commit is contained in:
eaglegai 2022-12-19 06:29:18 +00:00 committed by openeuler-sync-bot
parent 0ef8c184c4
commit 8978ab5ada
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From bf7cc74cd048bfd9d1fb9474e94a915cc9e86fdb Mon Sep 17 00:00:00 2001
From: eaglegai <eaglegai@163.com>
Date: Fri, 2 Dec 2022 09:47:06 +0800
Subject: [PATCH] fix ifconfig display error when the length of interface name is 15
Signed-off-by: eaglegai <eaglegai@163.com>
---
lib/interface.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/interface.c b/lib/interface.c
index baa9a9a..f321340 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -248,8 +248,10 @@ static const char *get_name(char **namep, const char *p)
}
*name++ = *p++;
count++;
- if (count == (IFNAMSIZ-1))
+ if (count == (IFNAMSIZ-1)) {
+ p++;
break;
+ }
}
*name++ = '\0';
return p;
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: net-tools
Version: 2.10
Release: 2
Release: 3
Summary: Important Programs for Networking
License: GPLv2+
URL: https://sourceforge.net/projects/net-tools/
@ -19,6 +19,7 @@ Patch1: backport-net-tools-cycle.patch
Patch2: backport-net-tools-man.patch
Patch3: backport-ether-wake-interfaces.patch
Patch4: backport-interface-change-pointopoint-short-flag-from-P-to-p.patch
Patch5: fix-ifconfig-display-error-when-the-length-of-interface-name-is-15.patch
BuildRequires: bluez-libs-devel gettext, libselinux libselinux-devel systemd gcc
%{?systemd_requires}
@ -45,6 +46,7 @@ cp %SOURCE8 ./man/en_US
%patch2 -p1 -b .man
%patch3 -p1 -b .interfaces
%patch4 -p1
%patch5 -p1
touch ./config.h
%build
@ -105,6 +107,12 @@ touch %{buildroot}%{_unitdir}/arp-ethers.service
%exclude %{_mandir}/pt/man5
%changelog
* Mon Dec 19 2022 eaglegai <eaglegai@163.com> - 2.10-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix ifconfig display error when the length of interface name is 15
* Thu Oct 20 2022 konglidong <konglidong@uniontech.com> - 2.10-2
- Type:bugfix
- ID:NA