Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1.chuqui 4/7/84; site voder.UUCP Path: utzoo!linus!decvax!ittvax!dcdwest!sdcsvax!sdcrdcf!hplabs!nsc!voder!jeff From: jeff@voder.UUCP Newsgroups: net.news.b,net.bugs.4bsd Subject: alarm() bug in 4.2 Message-ID: <282@voder.UUCP> Date: Tue, 10-Jul-84 00:05:50 EDT Article-I.D.: voder.282 Posted: Tue Jul 10 00:05:50 1984 Date-Received: Thu, 12-Jul-84 01:16:18 EDT Organization: National Semiconductor, Santa Clara Lines: 32 Xref: 130 342 There is a bug in the 4.2 implementation of alarm(3). In the following oldalarm = alarm(newalarm); oldalarm gets the current value of the interval timer *rounded down* to the nearest second. So ... for (...) { oldalarm = alarm((unsigned) 0); ... alarm(oldalarm); } causes the interval timer to be *repeatedly* rounded down. End result: the alarm goes off early. And, of course, if the interval timer just *happened* to be at some value *less* than a second the alarm will be turned off completely. Fortunately, there is an easy workaround; change the previous code to read: for (...) { oldmask = sigblock(1<