diff options
Diffstat (limited to 'contrib/sendmail/libsm/clock.c')
-rw-r--r-- | contrib/sendmail/libsm/clock.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/sendmail/libsm/clock.c b/contrib/sendmail/libsm/clock.c index eed1ded..ada9689 100644 --- a/contrib/sendmail/libsm/clock.c +++ b/contrib/sendmail/libsm/clock.c @@ -12,7 +12,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Id: clock.c,v 1.34 2001/11/05 18:33:20 ca Exp $") +SM_RCSID("@(#)$Id: clock.c,v 1.35 2002/03/22 18:34:38 gshapiro Exp $") #include <unistd.h> #include <time.h> #include <errno.h> @@ -160,6 +160,8 @@ sm_sigsafe_seteventm(intvl, func, arg) timersub(&SmEventQueue->ev_time, &now, &itime.it_value); itime.it_interval.tv_sec = 0; itime.it_interval.tv_usec = 0; + if (itime.it_value.tv_sec < 0) + itime.it_value.tv_sec = 0; if (itime.it_value.tv_sec == 0 && itime.it_value.tv_usec == 0) itime.it_value.tv_usec = 1000; (void) setitimer(ITIMER_REAL, &itime, NULL); @@ -412,6 +414,11 @@ sm_tick(sig) &clr.it_value); clr.it_interval.tv_sec = 0; clr.it_interval.tv_usec = 0; + if (clr.it_value.tv_sec < 0) + clr.it_value.tv_sec = 0; + if (clr.it_value.tv_sec == 0 && + clr.it_value.tv_usec == 0) + clr.it_value.tv_usec = 1000; (void) setitimer(ITIMER_REAL, &clr, NULL); } else @@ -452,6 +459,10 @@ sm_tick(sig) timersub(&SmEventQueue->ev_time, &now, &clr.it_value); clr.it_interval.tv_sec = 0; clr.it_interval.tv_usec = 0; + if (clr.it_value.tv_sec < 0) + clr.it_value.tv_sec = 0; + if (clr.it_value.tv_sec == 0 && clr.it_value.tv_usec == 0) + clr.it_value.tv_usec = 1000; (void) setitimer(ITIMER_REAL, &clr, NULL); #else /* SM_CONF_SETITIMER */ (void) alarm((unsigned) (SmEventQueue->ev_time - now)); |