diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-01-13 03:42:18 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-01-13 03:42:18 +0000 |
commit | 8839b46cd7cd1eddfb03a20449de2487bf77536a (patch) | |
tree | 4c2013d32477b244f64642661ff4cf5bf12c8246 /fetchmail.c | |
parent | cb13cd6d890ae4bebf63966f24aa7c12f84b13f1 (diff) | |
download | fetchmail-8839b46cd7cd1eddfb03a20449de2487bf77536a.tar.gz fetchmail-8839b46cd7cd1eddfb03a20449de2487bf77536a.tar.bz2 fetchmail-8839b46cd7cd1eddfb03a20449de2487bf77536a.zip |
Fix --quit uin root mode bug.
svn path=/trunk/; revision=750
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 20 |
1 files changed, 11 insertions, 9 deletions
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; |