diff options
| author | Sam Varshavchik | 2014-09-19 23:33:00 -0400 |
|---|---|---|
| committer | Sam Varshavchik | 2014-09-19 23:33:00 -0400 |
| commit | c1b0310ee059dea7bdfcbb148771adb931a6fdf2 (patch) | |
| tree | 9b0784459fd028d95da6efc11312bc9f673f7ec5 /maildir | |
| parent | 078b9a46a1eba1e912109b457a27ff65b3736c39 (diff) | |
| download | courier-libs-c1b0310ee059dea7bdfcbb148771adb931a6fdf2.tar.bz2 | |
Fix DH parameters, print a message on stderr if alarm goes off.
Diffstat (limited to 'maildir')
| -rw-r--r-- | maildir/maildirwatch.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/maildir/maildirwatch.c b/maildir/maildirwatch.c index cc73782..d0adc5d 100644 --- a/maildir/maildirwatch.c +++ b/maildir/maildirwatch.c @@ -12,6 +12,8 @@ #include <stdlib.h> #include <stdio.h> #include <errno.h> +#include <signal.h> +#include <sys/signal.h> #ifndef PATH_MAX #define PATH_MAX 4096 @@ -20,6 +22,15 @@ #if HAVE_FAM static struct maildirwatch_fam *maildirwatch_currentfam; + +static void alarm_handler(int signum) +{ + static const char msg[]= + "Timeout initializing the FAM library. Your FAM library is broken.\n"; + + write(2, msg, sizeof(msg)-1); + kill(getpid(), SIGKILL); +} #endif struct maildirwatch *maildirwatch_alloc(const char *maildir) @@ -58,6 +69,7 @@ struct maildirwatch *maildirwatch_alloc(const char *maildir) maildirwatch_currentfam->broken=0; maildirwatch_currentfam->refcnt=0; + signal(SIGALRM, alarm_handler); alarm(15); if (FAMOpen(&maildirwatch_currentfam->fc) < 0) { @@ -66,6 +78,7 @@ struct maildirwatch *maildirwatch_alloc(const char *maildir) maildirwatch_currentfam=NULL; } alarm(0); + signal(SIGALRM, SIG_DFL); } } |
