diff options
author | Markus Ullmann <jokey@gentoo.org> | 2007-06-03 07:56:25 +0000 |
---|---|---|
committer | Markus Ullmann <jokey@gentoo.org> | 2007-06-03 07:56:25 +0000 |
commit | 81809919a4ba2216d067d4b113575e48c6a98912 (patch) | |
tree | 192b998150c0846da4d71f14db1193767d177b0d /net-analyzer/nload | |
parent | Version bump. (bug #180369) (diff) | |
download | gentoo-2-81809919a4ba2216d067d4b113575e48c6a98912.tar.gz gentoo-2-81809919a4ba2216d067d4b113575e48c6a98912.tar.bz2 gentoo-2-81809919a4ba2216d067d4b113575e48c6a98912.zip |
Fix amd64 signedness bug, thanks to phreak
(Portage version: 2.1.2.9)
Diffstat (limited to 'net-analyzer/nload')
-rw-r--r-- | net-analyzer/nload/ChangeLog | 9 | ||||
-rw-r--r-- | net-analyzer/nload/files/digest-nload-0.6.0-r2 (renamed from net-analyzer/nload/files/digest-nload-0.6.0-r1) | 0 | ||||
-rw-r--r-- | net-analyzer/nload/files/nload-0.6.0-signedness.patch | 99 | ||||
-rw-r--r-- | net-analyzer/nload/nload-0.6.0-r2.ebuild (renamed from net-analyzer/nload/nload-0.6.0-r1.ebuild) | 4 |
4 files changed, 109 insertions, 3 deletions
diff --git a/net-analyzer/nload/ChangeLog b/net-analyzer/nload/ChangeLog index ef50b4644862..2e0dd10f9016 100644 --- a/net-analyzer/nload/ChangeLog +++ b/net-analyzer/nload/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for net-analyzer/nload # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nload/ChangeLog,v 1.21 2007/03/22 14:25:52 gustavoz Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nload/ChangeLog,v 1.22 2007/06/03 07:56:25 jokey Exp $ + +*nload-0.6.0-r2 (03 Jun 2007) + + 03 Jun 2007; Markus Ullmann <jokey@gentoo.org> + +files/nload-0.6.0-signedness.patch, -nload-0.6.0-r1.ebuild, + +nload-0.6.0-r2.ebuild: + Fix amd64 signedness bug, thanks to phreak 22 Mar 2007; Gustavo Zacarias <gustavoz@gentoo.org> nload-0.6.0-r1.ebuild: Stable on sparc diff --git a/net-analyzer/nload/files/digest-nload-0.6.0-r1 b/net-analyzer/nload/files/digest-nload-0.6.0-r2 index 821d6ef86e0c..821d6ef86e0c 100644 --- a/net-analyzer/nload/files/digest-nload-0.6.0-r1 +++ b/net-analyzer/nload/files/digest-nload-0.6.0-r2 diff --git a/net-analyzer/nload/files/nload-0.6.0-signedness.patch b/net-analyzer/nload/files/nload-0.6.0-signedness.patch new file mode 100644 index 000000000000..53d53c1a80e0 --- /dev/null +++ b/net-analyzer/nload/files/nload-0.6.0-signedness.patch @@ -0,0 +1,99 @@ +--- nload-0.6.0.orig/src/proc.h ++++ nload-0.6.0/src/proc.h +@@ -36,8 +36,8 @@ + + void readLoad( unsigned long& in, unsigned long& out ); + +- unsigned long totalIn(); +- unsigned long totalOut(); ++ long long totalIn(); ++ long long totalOut(); + + int getElapsedTime(); + +@@ -51,7 +51,7 @@ + + char m_ip[16]; + +- unsigned long m_total[2]; ++ long long m_total[2]; + + }; + +--- nload-0.6.0.orig/src/status.h ++++ nload-0.6.0/src/status.h +@@ -52,7 +52,7 @@ + gigabyte = 7 + }; + +- void update( unsigned long, unsigned long ); ++ void update( unsigned long, long long); + void print( Window&, int, int, status_format traff_format, status_format data_format ); + void resetTrafficData(); + +--- nload-0.6.0.orig/src/proc.cpp ++++ nload-0.6.0/src/proc.cpp +@@ -126,7 +126,7 @@ + + void Proc::readLoad( unsigned long& in, unsigned long& out ) + { +- unsigned long total_new[2] = { 0, 0 }; ++ long long total_new[2] = { 0, 0 }; + int curr_time = 0; + struct timeval time; + +@@ -181,7 +181,7 @@ + + if( ! strcmp( m_dev, dev ) ) + { +- sscanf( tmp, "%lu %*u %*u %*u %*u %*u %*u %*u %lu", &total_new[0], &total_new[1] ); ++ sscanf( tmp, "%llu %*u %*u %*u %*u %*u %*u %*u %llu", &total_new[0], &total_new[1] ); + + if( total_new[0] > m_total[0] ) + in = total_new[0] - m_total[0]; +@@ -198,7 +198,7 @@ + } + } while( 0 ); + +- fclose(fd); ++ if (fd != NULL) fclose(fd); + + #endif + // === End Linux specific network data reading code === +@@ -513,12 +513,12 @@ + return m_elapsed_time; + } + +-unsigned long Proc::totalIn() ++long long Proc::totalIn() + { + return m_total[0]; + } + +-unsigned long Proc::totalOut() ++long long Proc::totalOut() + { + return m_total[1]; + } +--- nload-0.6.0.orig/src/status.cpp ++++ nload-0.6.0/src/status.cpp +@@ -30,7 +30,7 @@ + } + + //new traffic measurement has been made => update statistics +-void Status::update( unsigned long new_value, unsigned long new_total ) ++void Status::update( unsigned long new_value, long long new_total ) + { + + m_cur = new_value; +@@ -44,7 +44,9 @@ + *the /proc/net/dev file + *(the total bytes value reaches 4GB and then switches to 0) + */ +- if( new_total < ( m_total % UINT_MAX ) ) ++ if (new_total >= UINT_MAX ) ++ m_total = new_total; ++ else if ( new_total < ( m_total % UINT_MAX ) ) + m_total = ( ( m_total / UINT_MAX ) + 1 ) * UINT_MAX + new_total; + else + m_total = ( m_total / UINT_MAX ) * UINT_MAX + new_total; diff --git a/net-analyzer/nload/nload-0.6.0-r1.ebuild b/net-analyzer/nload/nload-0.6.0-r2.ebuild index 2454274f17f1..ea032512dca7 100644 --- a/net-analyzer/nload/nload-0.6.0-r1.ebuild +++ b/net-analyzer/nload/nload-0.6.0-r2.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nload/nload-0.6.0-r1.ebuild,v 1.3 2007/03/22 14:25:52 gustavoz Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nload/nload-0.6.0-r2.ebuild,v 1.1 2007/06/03 07:56:25 jokey Exp $ inherit eutils autotools @@ -19,6 +19,7 @@ src_unpack() { unpack ${A} cd "${S}" epatch "${FILESDIR}"/${P}-prevent-stripping.patch + epatch "${FILESDIR}"/${P}-signedness.patch eautoreconf } @@ -27,4 +28,3 @@ src_install () { einstall || die dodoc README INSTALL ChangeLog AUTHORS } - |