tcptrack: fix logic for showing idle-time >3600

This commit is contained in:
Đoàn Trần Công Danh 2022-11-17 22:46:19 +07:00
parent 16d806c7db
commit 8be09e4a3d
2 changed files with 31 additions and 1 deletions

View file

@ -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() )

View file

@ -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"