From: Mark Wooding Date: Wed, 20 Sep 2006 15:20:23 +0000 (+0100) Subject: noise: Fix freewheel generator's use of setitimer(2). X-Git-Tag: 2.1.1~31 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb/commitdiff_plain/ff98dc94cb5d9498cd92edd6b734ec863d763852?ds=inline;hp=-c noise: Fix freewheel generator's use of setitimer(2). If the old timer was turned off, don't accidentally turn it on. While on some Linux versions, this seems harmless enough, on others it causes spurious SIGALRM signals to be sent to the process, which is terribly unhelpful. --- ff98dc94cb5d9498cd92edd6b734ec863d763852 diff --git a/noise.c b/noise.c index 90889306..c122506f 100644 --- a/noise.c +++ b/noise.c @@ -390,7 +390,8 @@ int noise_freewheel(rand_pool *r) done: signal(SIGALRM, sigal); - TV_SUB(&oitv.it_value, &oitv.it_value, &itv.it_value); + if (oitv.it_value.tv_sec || oitv.it_value.tv_usec) + TV_SUB(&oitv.it_value, &oitv.it_value, &itv.it_value); setitimer(ITIMER_REAL, &oitv, 0); return (rc); }