aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--fetchmail.c20
2 files changed, 11 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index d8286534..0f1e0efc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,5 @@
To Do:
-The --quit flag is broken when running as root.
-
Try to change the daemon-mode loop so the poll comes before the wait,
not after it.
diff --git a/fetchmail.c b/fetchmail.c
index abe2e813..76fc0f15 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -90,7 +90,7 @@ static void unlockit(void)
int main (int argc, char **argv)
{
int st, bkgd = FALSE;
- int parsestatus, implicitmode, sigwakeup;
+ int parsestatus, implicitmode;
char *home, *tmpdir, tmpbuf[BUFSIZ];
struct passwd *pw;
struct query *ctl;
@@ -158,12 +158,9 @@ int main (int argc, char **argv)
implicitmode = load_params(argc, argv, optind);
/* set up to do lock protocol */
- if (poll_interval && getuid() == 0) {
- sigwakeup = SIGHUP;
+ if (!getuid())
strcpy(tmpbuf, "/var/run/fetchmail.pid");
- }
else {
- sigwakeup = SIGUSR1;
strcpy(tmpbuf, home);
strcat(tmpbuf, "/.fetchmail");
}
@@ -273,7 +270,7 @@ int main (int argc, char **argv)
pid);
return(PS_EXCLUDE);
}
- else if (kill(pid, sigwakeup) == 0)
+ else if (kill(pid, SIGUSR1) == 0)
{
fprintf(stderr,
"fetchmail: background fetchmail at %d awakened.\n",
@@ -360,7 +357,11 @@ int main (int argc, char **argv)
* side effect of interrupting any sleep that may be going on,
* forcing fetchmail to re-poll its hosts.
*/
- signal(sigwakeup, donothing);
+ signal(SIGUSR1, donothing);
+
+ /* pacify people who think all system daemons wake up on SIGHUP */
+ if (poll_interval && !getuid())
+ signal(SIGHUP, donothing);
/* here's the exclusion lock */
if ( (lockfp = fopen(lockfile,"w")) != NULL ) {
@@ -414,7 +415,9 @@ int main (int argc, char **argv)
signal(SIGALRM, donothing);
pause();
signal(SIGALRM, SIG_IGN);
- if (lastsig == sigwakeup) {
+ if (lastsig == SIGUSR1
+ || ((poll_interval && !getuid()) && lastsig == SIGHUP))
+ {
#ifdef SYS_SIGLIST_DECLARED
error(0, 0, "awakened by %s", sys_siglist[lastsig]);
#else
@@ -432,7 +435,6 @@ int main (int argc, char **argv)
}
}
-
#ifdef linux
if (!interface_approve())
continue;