From 7086e875ca3e382883f31ef4385044d77c66c035 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Thu, 14 Oct 2004 11:21:02 +0000 Subject: [PATCH] Arrange to panic-die if setitimer() ever fails. Version number upped in readiness for next release. --- doc/doc-txt/ChangeLog | 6 +++++- src/src/exim.c | 11 ++++++++--- src/src/version.c | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 83d2ff066..6e1d523b4 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.3 2004/10/11 13:24:19 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.4 2004/10/14 11:21:02 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -12,6 +12,10 @@ Exim version 4.44 2. Change 4.43/35 introduced a bug: if quota_filecount was set, the computation of the current number of files was incorrect. + 3. Closing a stable door: arrange to panic-die if setitimer() ever fails. The + bug fixed in 4.43/37 would have been diagnosed quickly if this had been in + place. + Exim version 4.43 ----------------- diff --git a/src/src/exim.c b/src/src/exim.c index 6d227c33e..37f206d26 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/exim.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */ +/* $Cambridge: exim/src/src/exim.c,v 1.2 2004/10/14 11:21:02 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -196,7 +196,10 @@ os_non_restarting_signal(SIGALRM, sigalrm_handler); /* This function is called by millisleep() and exim_wait_tick() to wait for a period of time that may include a fraction of a second. The coding is somewhat -tedious... +tedious. We do not expect setitimer() ever to fail, but if it does, the process +will wait for ever, so we panic in this instance. (There was a case of this +when a bug in a function that calls milliwait() caused it to pass invalid data. +That's when I added the check. :-) Argument: an itimerval structure containing the interval Returns: nothing @@ -210,7 +213,9 @@ sigset_t old_sigmask; (void)sigemptyset(&sigmask); /* Empty mask */ (void)sigaddset(&sigmask, SIGALRM); /* Add SIGALRM */ (void)sigprocmask(SIG_BLOCK, &sigmask, &old_sigmask); /* Block SIGALRM */ -(void)setitimer(ITIMER_REAL, itval, NULL); /* Start timer */ +if (setitimer(ITIMER_REAL, itval, NULL) < 0) /* Start timer */ + log_write(0, LOG_MAIN|LOG_PANIC_DIE, + "setitimer() failed: %s", strerror(errno)); (void)sigfillset(&sigmask); /* All signals */ (void)sigdelset(&sigmask, SIGALRM); /* Remove SIGALRM */ (void)sigsuspend(&sigmask); /* Until SIGALRM */ diff --git a/src/src/version.c b/src/src/version.c index 16554ad6e..6391d13bf 100644 --- a/src/src/version.c +++ b/src/src/version.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/version.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */ +/* $Cambridge: exim/src/src/version.c,v 1.2 2004/10/14 11:21:02 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -12,7 +12,7 @@ #include "exim.h" -#define THIS_VERSION "4.43" +#define THIS_VERSION "4.44" /* The header file cnumber.h contains a single line containing the -- 2.25.1