aboutsummaryrefslogtreecommitdiffstats
path: root/fetchmail.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2009-05-29 07:53:59 +0000
committerMatthias Andree <matthias.andree@gmx.de>2009-05-29 07:53:59 +0000
commite168a13ce589300db74c09e82bbe63c1297a1274 (patch)
tree7d64b648a2ce43783c0a8945c591e1dbd1c89240 /fetchmail.c
parent01c9b0afb3e30324f2984cece695f79b925d7a9f (diff)
downloadfetchmail-e168a13ce589300db74c09e82bbe63c1297a1274.tar.gz
fetchmail-e168a13ce589300db74c09e82bbe63c1297a1274.tar.bz2
fetchmail-e168a13ce589300db74c09e82bbe63c1297a1274.zip
Let logfile take precedence over syslog if and only if logfile is effective.
svn path=/branches/BRANCH_6-3/; revision=5349
Diffstat (limited to 'fetchmail.c')
-rw-r--r--fetchmail.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fetchmail.c b/fetchmail.c
index 7fa836b4..ad02b700 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -302,6 +302,11 @@ int main(int argc, char **argv)
if (!quitonly)
implicitmode = load_params(argc, argv, optind);
+ /* precedence: logfile (if effective) overrides syslog. */
+ if (run.logfile && run.poll_interval && !nodetach) {
+ run.use_syslog = 0;
+ }
+
#if defined(HAVE_SYSLOG)
/* logging should be set up early in case we were restarted from exec */
if (run.use_syslog)
@@ -556,8 +561,13 @@ int main(int argc, char **argv)
/* avoid zombies from plugins */
deal_with_sigchld();
+ /* Fix up log destination - if the if() is true, the precedence rule
+ * above hasn't killed off the syslog option, because the logfile
+ * option is ineffective (because we're not detached or not in
+ * deamon mode), so kill it for the benefit of other parts of the
+ * code. */
if (run.logfile && run.use_syslog)
- fprintf(stderr, GT_("fetchmail: Warning: syslog and logfile are set. Check both for logs!\n"));
+ run.logfile = 0;
/*
* Maybe time to go to demon mode...