ports/156825: [maintainer] [patch] sysutils/uptimed Fix math error

Rob Farmer rfarmer at predatorlabs.net
Thu May 5 08:30:14 UTC 2011


>Number:         156825
>Category:       ports
>Synopsis:       [maintainer] [patch] sysutils/uptimed Fix math error
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 05 08:30:14 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Rob Farmer
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD turquoise.predatorlabs.net 9.0-CURRENT FreeBSD 9.0-CURRENT #3: Wed May  4 22:45:37 PDT 2011     rfarmer at turquoise.predatorlabs.net:/usr/obj/usr/src/sys/TURQUOISE  amd64
>Description:
Fix where percent uptime is calculated as:
(up*100)/(up-down)

Should be:
(up*100)/(up+down)

Patch from:
http://bugs.gentoo.org/show_bug.cgi?id=332753

Reported by: Akira Norimaki <sutter.cane at rx78.org>

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/sysutils/uptimed/Makefile,v
retrieving revision 1.18
diff -u -r1.18 Makefile
--- Makefile	4 Dec 2010 07:33:41 -0000	1.18
+++ Makefile	5 May 2011 06:57:19 -0000
@@ -6,6 +6,7 @@
 
 PORTNAME=	uptimed
 PORTVERSION=	0.3.16
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	http://podgorny.cz/uptimed/releases/ \
 		http://www.predatorlabs.net/dl/
Index: files/patch-src__uprecords.c
===================================================================
RCS file: files/patch-src__uprecords.c
diff -N files/patch-src__uprecords.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-src__uprecords.c	5 May 2011 06:56:58 -0000
@@ -0,0 +1,12 @@
+--- ./src/uprecords.c.orig	2009-01-01 15:46:00.000000000 -0800
++++ ./src/uprecords.c	2011-05-04 23:56:53.000000000 -0700
+@@ -236,6 +236,9 @@
+ 			totalutime += u->utime;
+ 		}
+ 		
++		/* Prevents the downtime from showing as -x days, and the uptime as >100% */
++		totaldtime = -totaldtime;
++
+ 		print_entry(totalutime, "since", since, "up", 0, 0);
+ 		print_entry(totaldtime, "since", since, "down", 0, 0);
+ 		


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list