diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2006-08-07 09:32:34 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2006-08-07 09:32:34 +0000 |
commit | d0da38ee3f178d260ccb80875d5d5fd7e9b3fd98 (patch) | |
tree | 038277755fb8f7b82b9c3f244132be3dc74369a3 /fetchmail.c | |
parent | 8f9f7375e656c9d339805df343bdb88f57c6eeff (diff) | |
download | fetchmail-d0da38ee3f178d260ccb80875d5d5fd7e9b3fd98.tar.gz fetchmail-d0da38ee3f178d260ccb80875d5d5fd7e9b3fd98.tar.bz2 fetchmail-d0da38ee3f178d260ccb80875d5d5fd7e9b3fd98.zip |
--logfile is now handled more carefully, errors opening the logfile are
now reported to the TTY where fetchmail was started from.
fetchmail now complains and aborts when it cannot properly daemonize itself.
svn path=/branches/BRANCH_6-3/; revision=4883
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/fetchmail.c b/fetchmail.c index ad351dff..d417ab38 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -541,13 +541,23 @@ int main(int argc, char **argv) /* avoid zombies from plugins */ deal_with_sigchld(); + if (run.logfile && run.use_syslog) + fprintf(stderr, GT_("fetchmail: Warning: syslog and logfile are set. Check both for logs!\n")); + /* * Maybe time to go to demon mode... */ if (run.poll_interval) { - if (!nodetach) - daemonize(run.logfile); + if (!nodetach) { + int rc; + + rc = daemonize(run.logfile); + if (rc) { + report(stderr, GT_("fetchmail: Cannot detach into background. Aborting.\n")); + exit(rc); + } + } report(stdout, GT_("starting fetchmail %s daemon \n"), VERSION); /* @@ -560,12 +570,15 @@ int main(int argc, char **argv) } else { + /* not in daemon mode */ if (run.logfile && !nodetach && access(run.logfile, F_OK) == 0) { if (!freopen(run.logfile, "a", stdout)) report(stderr, GT_("could not open %s to append logs to \n"), run.logfile); if (!freopen(run.logfile, "a", stderr)) report(stdout, GT_("could not open %s to append logs to \n"), run.logfile); + if (run.use_syslog) + report(stdout, GT_("fetchmail: Warning: syslog and logfile are set. Check both for logs!\n")); } } |