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.
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);
}