Date: Sun, 3 Aug 1997 08:26:39 +0200 (SAT) From: John Hay <jhay@mikom.csir.co.za> To: current@freebsd.org Subject: clock_settime() error? Message-ID: <199708030626.IAA06139@zibbi.mikom.csir.co.za>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708030626.IAA06139>
