From 7dbf24931e45fbbd507f8b1c1efaac7425a99bfd Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Fri, 18 Oct 1985 02:55:07 -0800 Subject: [PATCH] return old timer value, even when a new one is not specified (from ralph) SCCS-vsn: sys/kern/kern_time.c 6.7 --- usr/src/sys/kern/kern_time.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/usr/src/sys/kern/kern_time.c b/usr/src/sys/kern/kern_time.c index 9238ab4090..19009e2a35 100644 --- a/usr/src/sys/kern/kern_time.c +++ b/usr/src/sys/kern/kern_time.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)kern_time.c 6.6 (Berkeley) %G% + * @(#)kern_time.c 6.7 (Berkeley) %G% */ #include "../machine/reg.h" @@ -172,7 +172,7 @@ setitimer() u_int which; struct itimerval *itv, *oitv; } *uap = (struct a *)u.u_ap; - struct itimerval aitv; + struct itimerval aitv, *aitvp; int s; register struct proc *p = u.u_procp; @@ -180,14 +180,16 @@ setitimer() u.u_error = EINVAL; return; } - u.u_error = copyin((caddr_t)uap->itv, (caddr_t)&aitv, - sizeof (struct itimerval)); - if (u.u_error) - return; + aitvp = uap->itv; if (uap->oitv) { uap->itv = uap->oitv; getitimer(); } + if (aitvp == 0) + return; + u.u_error = copyin(aitvp, (caddr_t)&aitv, sizeof (struct itimerval)); + if (u.u_error) + return; if (itimerfix(&aitv.it_value) || itimerfix(&aitv.it_interval)) { u.u_error = EINVAL; return; -- 2.20.1