diff options
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fetchmail.c b/fetchmail.c index ade69cc2..93f4754a 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -116,6 +116,12 @@ static char *timestamp (void) #define timestamp rfc822timestamp #endif +static RETSIGTYPE donothing(int sig) +{ + extern volatile int lastsig; /* declared in idle.c */ + signal(sig, donothing); lastsig = sig; +} + int main(int argc, char **argv) { int bkgd = FALSE; @@ -719,6 +725,17 @@ int main(int argc, char **argv) GT_("sleeping at %s\n"), timestamp()); /* + * With this simple hack, we make it possible for a foreground + * fetchmail to wake up one in daemon mode. What we want is the + * side effect of interrupting any sleep that may be going on, + * forcing fetchmail to re-poll its hosts. The second line is + * for people who think all system daemons wake up on SIGHUP. + */ + signal(SIGUSR1, donothing); + if (!getuid()) + signal(SIGHUP, donothing); + + /* * OK, now pause until it's time for the next poll cycle. * A nonzero return indicates we received a wakeup signal; * unwedge all servers in case the problem has been |