Avoid corrupting globals during time-pauses
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 17 Mar 2020 12:33:47 +0000 (12:33 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 17 Mar 2020 20:09:25 +0000 (20:09 +0000)
src/src/exim.c

index 4e4b6bb754570a71a635cd0d82d5ae2b917baf52..5e2f437993b3363a365e8fd800117cfd78d178d3 100644 (file)
@@ -309,6 +309,7 @@ milliwait(struct itimerval *itval)
 {
 sigset_t sigmask;
 sigset_t old_sigmask;
+int save_errno = errno;
 
 if (itval->it_value.tv_usec < 50 && itval->it_value.tv_sec == 0)
   return;
@@ -322,6 +323,8 @@ if (setitimer(ITIMER_REAL, itval, NULL) < 0)           /* Start timer */
 (void)sigdelset(&sigmask, SIGALRM);                    /* Remove SIGALRM */
 (void)sigsuspend(&sigmask);                            /* Until SIGALRM */
 (void)sigprocmask(SIG_SETMASK, &old_sigmask, NULL);    /* Restore mask */
+errno = save_errno;
+sigalrm_seen = FALSE;
 }