From 8be09e4a3d112b7a5ae743a3af8871e1eb2e4829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Thu, 17 Nov 2022 22:46:19 +0700 Subject: [PATCH] tcptrack: fix logic for showing idle-time >3600 --- srcpkgs/tcptrack/patches/format-time-t.patch | 30 ++++++++++++++++++++ srcpkgs/tcptrack/template | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/tcptrack/patches/format-time-t.patch diff --git a/srcpkgs/tcptrack/patches/format-time-t.patch b/srcpkgs/tcptrack/patches/format-time-t.patch new file mode 100644 index 00000000000..f2c5f66b5db --- /dev/null +++ b/srcpkgs/tcptrack/patches/format-time-t.patch @@ -0,0 +1,30 @@ +Fix -Werror=format (hard error in gcc-12) + +Also the last leg is unreachable, +because when it's true, the second leg also true. +Index: tcptrack-1.4.3/src/TextUI.cc +=================================================================== +--- tcptrack-1.4.3.orig/src/TextUI.cc ++++ tcptrack-1.4.3/src/TextUI.cc +@@ -308,12 +308,15 @@ void TextUI::drawui() + printw("RESET"); + + move(row,58); +- if( ic->getIdleSeconds() < 60 ) +- printw("%ds",ic->getIdleSeconds()); +- else if( ic->getIdleSeconds() > 59 ) +- printw("%dm",ic->getIdleSeconds()/60); +- else if( ic->getIdleSeconds() > 3559 ) +- printw("%dh",ic->getIdleSeconds()/3600); ++ { ++ long long int idle = ic->getIdleSeconds(); ++ if( idle < 60 ) ++ printw("%llds",idle); ++ else if( idle > 3559 ) ++ printw("%lldh",idle/3600); ++ else if( idle > 59 ) ++ printw("%lldm",idle/60); ++ } + + move(row,63); + if( ic->activityToggle() ) diff --git a/srcpkgs/tcptrack/template b/srcpkgs/tcptrack/template index bb0d9c716f4..843067c6473 100644 --- a/srcpkgs/tcptrack/template +++ b/srcpkgs/tcptrack/template @@ -1,7 +1,7 @@ # Template file for 'tcptrack' pkgname=tcptrack version=1.4.3 -revision=2 +revision=3 build_style=gnu-configure makedepends="libpcap-devel ncurses-devel" short_desc="Monitor TCP connections on network"