return old timer value, even when a new one is not specified (from ralph)
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 18 Oct 1985 10:55:07 +0000 (02:55 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 18 Oct 1985 10:55:07 +0000 (02:55 -0800)
SCCS-vsn: sys/kern/kern_time.c 6.7

usr/src/sys/kern/kern_time.c

index 9238ab4..19009e2 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * 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"
  */
 
 #include "../machine/reg.h"
@@ -172,7 +172,7 @@ setitimer()
                u_int   which;
                struct  itimerval *itv, *oitv;
        } *uap = (struct a *)u.u_ap;
                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;
 
        int s;
        register struct proc *p = u.u_procp;
 
@@ -180,14 +180,16 @@ setitimer()
                u.u_error = EINVAL;
                return;
        }
                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 (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;
        if (itimerfix(&aitv.it_value) || itimerfix(&aitv.it_interval)) {
                u.u_error = EINVAL;
                return;