From owner-freebsd-current Sat Aug 2 23:26:47 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id XAA07641 for current-outgoing; Sat, 2 Aug 1997 23:26:47 -0700 (PDT) Received: from zibbi.mikom.csir.co.za (zibbi.mikom.csir.co.za [146.64.24.58]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id XAA07636 for ; Sat, 2 Aug 1997 23:26:43 -0700 (PDT) Received: (from jhay@localhost) by zibbi.mikom.csir.co.za (8.8.6/8.8.5) id IAA06139 for current@freebsd.org; Sun, 3 Aug 1997 08:26:39 +0200 (SAT) From: John Hay Message-Id: <199708030626.IAA06139@zibbi.mikom.csir.co.za> Subject: clock_settime() error? To: current@freebsd.org Date: Sun, 3 Aug 1997 08:26:39 +0200 (SAT) X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi, I have been playing with the latest xntpd and I got "Can't set time of day: Invalid argument" errors when it tried to step the time. I have traced it to the clock_settime() system call in kern_time.c. I think the test on line 171 is invalid: ------- if ((error = copyin(SCARG(uap, tp), &ats, sizeof(ats))) != 0) return (error); if (atv.tv_usec < 0 || ats.tv_nsec >= 1000000000) ^^^^^^^^^^^ return (EINVAL); TIMESPEC_TO_TIMEVAL(&atv, &ats); ------- At that time atv.tv_usec hasn't been assigned yet. It is only assigned a value two lines late in the TIMESPEC_TO_TIMEVAL() macro. Shouldn't it be ats.tv_sec? Or ats.tv_nsec maybe? Does anybody know what the check should be? John -- John Hay -- John.Hay@mikom.csir.co.za