Subject: kern/8589: adjtime(2): slight bug
To: None <gnats-bugs@gnats.netbsd.org>
From: NAKAJIMA Yoshihiro <nakayosh@kcn.ne.jp>
List: netbsd-bugs
Date: 10/09/1999 09:57:45
>Number:         8589
>Category:       kern
>Synopsis:       adjtime(2): slight bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct  9 09:57:00 1999
>Last-Modified:
>Originator:     NAKAJIMA Yoshihiro
>Organization:
>Release:        NetBSD-current 1999/10/08
>Environment:
System: NetBSD asura 1.4K NetBSD 1.4K (ASURA) #14: Sat Oct 9 17:44:52 JST 1999 nakayosh@asura:/usr/src/sys/arch/i386/compile/ASURA i386


>Description:
	In adjtime(2), if delta is larger than threshold, ten times
	adjust value is used.  But for negative delta, it doesn't work.

>How-To-Repeat:
>Fix:
diff -u src/sys/kern/kern_time.c.ORIG src/sys/kern/kern_time.c
--- src/sys/kern/kern_time.c.ORIG	Tue Aug 17 20:14:58 1999
+++ src/sys/kern/kern_time.c	Fri Oct  9 22:37:25 1999
@@ -358,7 +358,7 @@
 	 * overshoot and start taking us away from the desired final time.
 	 */
 	ndelta = atv.tv_sec * 1000000 + atv.tv_usec;
-	if (ndelta > bigadj)
+	if (ndelta > bigadj || ndelta < -bigadj)
 		ntickdelta = 10 * tickadj;
 	else
 		ntickdelta = tickadj;

>Audit-Trail:
>Unformatted: