bin/149130: grdc(6) stops after n/2 seconds
Andy Farkas
chuzzwassa at gmail.com
Sat Jul 31 05:30:04 UTC 2010
>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:
More information about the freebsd-bugs
mailing list