Date: Sat, 31 Jul 2010 02:57:23 GMT From: Andy Farkas <chuzzwassa@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/149130: grdc(6) stops after n/2 seconds Message-ID: <201007310257.o6V2vNkY039888@www.freebsd.org> Resent-Message-ID: <201007310530.o6V5U40B002325@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 149130
>Category: bin
>Synopsis: grdc(6) stops after n/2 seconds
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Jul 31 05:30:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Andy Farkas
>Release: 8.1-STABLE
>Organization:
>Environment:
FreeBSD 8.1-STABLE #0: Tue Jul 27 21:37:41 EST 2010
>Description:
man 6 grdc states "With an optional numeric argument n it stops after n
seconds (default never)."
Currently, if n is provided, grdc stops before n/2 seconds.
This patch fixes the problem and also makes sure it stops *after* n seconds
like the man page says.
>How-To-Repeat:
> time grdc 10
..
4.16 real 0.05 user 0.00 sys
>
>Fix:
--- /usr/src/games/grdc/grdc.c 2010-03-12 10:51:13.000000000 +1000
+++ ./grdc.c 2010-07-31 12:43:57.000000000 +1000
@@ -204,9 +204,9 @@
ts.tv_nsec = 0;
}
nanosleep(&ts, NULL);
- now = ts.tv_sec + 1;
+ ++now;
} else
- now = ts.tv_sec;
+ now = ts.tv_sec + 1;
if (sigtermed) {
standend();
clear();
@@ -214,7 +214,7 @@
endwin();
errx(1, "terminated by signal %d", (int)sigtermed);
}
- } while(--n);
+ } while(n--);
standend();
clear();
refresh();
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007310257.o6V2vNkY039888>
