diff options
author | ache <ache@FreeBSD.org> | 1997-08-14 08:15:12 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-08-14 08:15:12 +0000 |
commit | 4ef0ac8df99354f547ef2b6198eb0546c1ff7beb (patch) | |
tree | 6c811d9bcfacad5682344b499ef0e75860954c04 /sys | |
parent | d5b03c1103915b856a6ad7000abf64c97f048188 (diff) | |
download | FreeBSD-src-4ef0ac8df99354f547ef2b6198eb0546c1ff7beb.zip FreeBSD-src-4ef0ac8df99354f547ef2b6198eb0546c1ff7beb.tar.gz |
setitimer: if it_value == 0 clear it_interval now
non-zero it_interval values have no sense if it_value == 0 but
checked by itimerfix which may cause EINVAL return
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_time.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index e938b5e..fbb6453 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 - * $Id: kern_time.c,v 1.30 1997/08/03 07:26:50 bde Exp $ + * $Id: kern_time.c,v 1.31 1997/08/13 17:55:11 ache Exp $ */ #include <sys/param.h> @@ -583,7 +583,11 @@ setitimer(p, uap, retval) return (error); if (itvp == 0) return (0); - if (itimerfix(&aitv.it_value) || itimerfix(&aitv.it_interval)) + if (itimerfix(&aitv.it_value)) + return (EINVAL); + if (!timerisset(&aitv.it_value)) + timerclear(&aitv.it_interval); + else if (itimerfix(&aitv.it_interval)) return (EINVAL); s = splclock(); if (uap->which == ITIMER_REAL) { |