fix some compilation warnings

(cherry picked from commit 063df7c5b7da16acae47d65188eb13f58e0a75ca)
This commit is contained in:
yangl777 2022-10-20 09:06:33 +00:00 committed by openeuler-sync-bot
parent d50fa2d999
commit d8d10e544c
4 changed files with 102 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From c090f7fbafa7a17a807644d92dde736327da23b7 Mon Sep 17 00:00:00 2001
From: Vitezslav Samel <vitezslav@samel.cz>
Date: Thu, 5 May 2022 20:48:14 +0200
Subject: [PATCH] addethentry(): use correct format specifier
Fixes warning from gcc-11.2.
Conflict: NA
Reference:https://github.com/iptraf-ng/iptraf-ng/commit/c090f7fbafa7a17a807644d92dde736327da23b7
Signed-off-by: Vitezslav Samel <vitezslav@samel.cz>
---
src/hostmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hostmon.c b/src/hostmon.c
index 1214483..ef37f55 100644
--- a/src/hostmon.c
+++ b/src/hostmon.c
@@ -290,7 +290,7 @@ static struct ethtabent *addethentry(struct ethtab *table,
table->entcount++;
- mvwprintw(table->borderwin, LINES - 3, 1, " %u entries ",
+ mvwprintw(table->borderwin, LINES - 3, 1, " %lu entries ",
table->entcount);
return ptemp;

View File

@ -0,0 +1,34 @@
From 48da13d3208e1f102308eb2803701df7a9470352 Mon Sep 17 00:00:00 2001
From: Vitezslav Samel <vitezslav@samel.cz>
Date: Thu, 5 May 2022 20:39:18 +0200
Subject: [PATCH] updatetimes(): use correct format specifier for time_t type
Fixes warning from gcc-11.2.
Conflict: NA
Reference:https://github.com/iptraf-ng/iptraf-ng/commit/48da13d3208e1f102308eb2803701df7a9470352
Signed-off-by: Vitezslav Samel <vitezslav@samel.cz>
---
src/options.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/options.c b/src/options.c
index 3d7985e..9cef140 100644
--- a/src/options.c
+++ b/src/options.c
@@ -179,10 +179,10 @@ void loadoptions(void)
static void updatetimes(WINDOW *win)
{
wattrset(win, HIGHATTR);
- mvwprintw(win, 10, 25, "%3u mins", options.timeout);
- mvwprintw(win, 11, 25, "%3u mins", options.logspan / 60);
- mvwprintw(win, 12, 25, "%3u secs", options.updrate);
- mvwprintw(win, 13, 25, "%3u mins", options.closedint);
+ mvwprintw(win, 10, 25, "%3ld mins", options.timeout);
+ mvwprintw(win, 11, 25, "%3ld mins", options.logspan / 60);
+ mvwprintw(win, 12, 25, "%3ld secs", options.updrate);
+ mvwprintw(win, 13, 25, "%3ld mins", options.closedint);
}
static void showoptions(WINDOW *win)

View File

@ -0,0 +1,29 @@
From 42b8126f0ddfabf89aa8ec2345f726915d8cf97e Mon Sep 17 00:00:00 2001
From: Vitezslav Samel <vitezslav@samel.cz>
Date: Thu, 5 May 2022 20:44:44 +0200
Subject: [PATCH] printdetails(): use correct format specifier when printing
packet count
Fixes warning from gcc-11.2.
Conflict: NA
Reference:https://github.com/iptraf-ng/iptraf-ng/commit/42b8126f0ddfabf89aa8ec2345f726915d8cf97e
Signed-off-by: Vitezslav Samel <vitezslav@samel.cz>
---
src/detstats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/detstats.c b/src/detstats.c
index 7c5ff3f..e6c515b 100644
--- a/src/detstats.c
+++ b/src/detstats.c
@@ -406,7 +406,7 @@ static void printdetails(struct ifcounts *ifcounts, WINDOW * win)
/* Bad packet count */
- mvwprintw(win, 19, 65, "%8lu", ifcounts->bad.pc_packets);
+ mvwprintw(win, 19, 65, "%8llu", ifcounts->bad.pc_packets);
}
static void detstats_process_key(int ch)

View File

@ -1,13 +1,17 @@
Name: iptraf-ng Name: iptraf-ng
Summary: A console-based network monitoring utility Summary: A console-based network monitoring utility
Version: 1.2.1 Version: 1.2.1
Release: 1 Release: 2
License: GPLv2+ License: GPLv2+
URL: https://github.com/%{name}/%{name}/ URL: https://github.com/%{name}/%{name}/
Source0: https://github.com/%{name}/%{name}/archive/v%{version}.tar.gz Source0: https://github.com/%{name}/%{name}/archive/v%{version}.tar.gz
Source1: %{name}-logrotate.conf Source1: %{name}-logrotate.conf
Source2: %{name}-tmpfiles.conf Source2: %{name}-tmpfiles.conf
Patch0: backport-use-correct-format-specifier-for-time_t-type.patch
Patch1: backport-use-correct-format-specifier-when-printing-packet-count.patch
Patch2: backport-use-correct-format-specifier-for-table-entcount-variable.patch
BuildRequires: gcc ncurses-devel BuildRequires: gcc ncurses-devel
Obsoletes: iptraf < 3.1 Obsoletes: iptraf < 3.1
Provides: iptraf = 3.1 Provides: iptraf = 3.1
@ -70,6 +74,12 @@ install -d -m 0755 %{buildroot}/run/%{name}/
%{_mandir}/man8/*.8.gz %{_mandir}/man8/*.8.gz
%changelog %changelog
* Thu Oct 20 2022 yanglu <yanglu72@h-partners.com> - 1.2.1-2
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:fix some compilation warnings
* Tue Jan 26 2021 xihaochen <xihaochen@huawei.com> - 1.2.1-1 * Tue Jan 26 2021 xihaochen <xihaochen@huawei.com> - 1.2.1-1
- Type:requirements - Type:requirements
- Id:NA - Id:NA