Fix setitimer implementation.

Although we made sure that in->it_interval is either zero or equal to
in->it_value, we were still using in->it_interval to compute the timeout,
which could be zero, for example, with git-log's --early-output flag.
Use in->it_value instead.

On the otherhand, we used in->it_value to check for a single-shot timer.
Use in->it_interval instead.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This commit is contained in:
Johannes Sixt
2007-11-26 13:14:34 +01:00
parent 3920a6b76b
commit bfe13b6357

View File

@@ -978,8 +978,8 @@ int setitimer(int type, struct itimerval *in, struct itimerval *out)
is_timeval_eq(&in->it_interval, &zero))
return 0;
timer_interval = in->it_interval.tv_sec * 1000 + in->it_interval.tv_usec / 1000;
one_shot = is_timeval_eq(&in->it_value, &zero);
timer_interval = in->it_value.tv_sec * 1000 + in->it_value.tv_usec / 1000;
one_shot = is_timeval_eq(&in->it_interval, &zero);
if (!atexit_done) {
atexit(stop_timer_thread);
atexit_done = 1;