aboutsummaryrefslogtreecommitdiffstats
path: root/fetchmail.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2002-08-26 18:47:09 +0000
committerEric S. Raymond <esr@thyrsus.com>2002-08-26 18:47:09 +0000
commitc80d3c6b9cde8128a702b13215fd5c1c60d54103 (patch)
tree8821c6dcc957551ed0cc00f207a2ecfc26b3403a /fetchmail.c
parentdc3858c16e0d02f1e0f8b5f7dd8f0b787bbdcbfd (diff)
downloadfetchmail-c80d3c6b9cde8128a702b13215fd5c1c60d54103.tar.gz
fetchmail-c80d3c6b9cde8128a702b13215fd5c1c60d54103.tar.bz2
fetchmail-c80d3c6b9cde8128a702b13215fd5c1c60d54103.zip
Refactor so we can use idle.c in the cookbook.
svn path=/trunk/; revision=3688
Diffstat (limited to 'fetchmail.c')
-rw-r--r--fetchmail.c17
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