From 4774378ccf3e148349a6ec26c04975d1ed4416dc Mon Sep 17 00:00:00 2001 From: yangl777 Date: Thu, 20 Oct 2022 09:06:33 +0000 Subject: [PATCH] fix some compilation warnings (cherry picked from commit 063df7c5b7da16acae47d65188eb13f58e0a75ca) --- ...pecifier-for-table-entcount-variable.patch | 28 +++++++++++++++ ...ect-format-specifier-for-time_t-type.patch | 34 +++++++++++++++++++ ...specifier-when-printing-packet-count.patch | 29 ++++++++++++++++ iptraf-ng.spec | 12 ++++++- 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 backport-use-correct-format-specifier-for-table-entcount-variable.patch create mode 100644 backport-use-correct-format-specifier-for-time_t-type.patch create mode 100644 backport-use-correct-format-specifier-when-printing-packet-count.patch diff --git a/backport-use-correct-format-specifier-for-table-entcount-variable.patch b/backport-use-correct-format-specifier-for-table-entcount-variable.patch new file mode 100644 index 0000000..7562c44 --- /dev/null +++ b/backport-use-correct-format-specifier-for-table-entcount-variable.patch @@ -0,0 +1,28 @@ +From c090f7fbafa7a17a807644d92dde736327da23b7 Mon Sep 17 00:00:00 2001 +From: Vitezslav Samel +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 +--- + 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; diff --git a/backport-use-correct-format-specifier-for-time_t-type.patch b/backport-use-correct-format-specifier-for-time_t-type.patch new file mode 100644 index 0000000..a864406 --- /dev/null +++ b/backport-use-correct-format-specifier-for-time_t-type.patch @@ -0,0 +1,34 @@ +From 48da13d3208e1f102308eb2803701df7a9470352 Mon Sep 17 00:00:00 2001 +From: Vitezslav Samel +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 +--- + 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) diff --git a/backport-use-correct-format-specifier-when-printing-packet-count.patch b/backport-use-correct-format-specifier-when-printing-packet-count.patch new file mode 100644 index 0000000..d189eb4 --- /dev/null +++ b/backport-use-correct-format-specifier-when-printing-packet-count.patch @@ -0,0 +1,29 @@ +From 42b8126f0ddfabf89aa8ec2345f726915d8cf97e Mon Sep 17 00:00:00 2001 +From: Vitezslav Samel +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 +--- + 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) diff --git a/iptraf-ng.spec b/iptraf-ng.spec index 5b03ec2..cc9f025 100644 --- a/iptraf-ng.spec +++ b/iptraf-ng.spec @@ -1,13 +1,17 @@ Name: iptraf-ng Summary: A console-based network monitoring utility Version: 1.2.1 -Release: 1 +Release: 2 License: GPLv2+ URL: https://github.com/%{name}/%{name}/ Source0: https://github.com/%{name}/%{name}/archive/v%{version}.tar.gz Source1: %{name}-logrotate.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 Obsoletes: iptraf < 3.1 Provides: iptraf = 3.1 @@ -70,6 +74,12 @@ install -d -m 0755 %{buildroot}/run/%{name}/ %{_mandir}/man8/*.8.gz %changelog +* Thu Oct 20 2022 yanglu - 1.2.1-2 +- Type:bugfix +- Id:NA +- SUG:NA +- DESC:fix some compilation warnings + * Tue Jan 26 2021 xihaochen - 1.2.1-1 - Type:requirements - Id:NA -- Gitee