diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2000-01-09 07:10:21 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2000-01-09 07:10:21 +0000 |
commit | 897e3a72515562699f2d2c9bd24d8c16010596cf (patch) | |
tree | 796a4365fdd544299a44c8703234d66ca130665f /fetchmail.c | |
parent | 6fad7ffe5cbd7ae54128feeaea64d77b2adaa94f (diff) | |
download | fetchmail-897e3a72515562699f2d2c9bd24d8c16010596cf.tar.gz fetchmail-897e3a72515562699f2d2c9bd24d8c16010596cf.tar.bz2 fetchmail-897e3a72515562699f2d2c9bd24d8c16010596cf.zip |
Fixed the syslog problem.
svn path=/trunk/; revision=2706
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/fetchmail.c b/fetchmail.c index 33a2ecca..14a6cdaf 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -183,17 +183,11 @@ int main(int argc, char **argv) textdomain(PACKAGE); #endif - /* logging must be set up early in case we were restarted from exec */ -#if defined(HAVE_SYSLOG) - if (run.use_syslog) - { - openlog(program_name, LOG_PID, LOG_MAIL); - report_init(-1); - } - else -#endif - report_init((run.poll_interval == 0 || nodetach) && !run.logfile); - + /* + * Note: because we can't initialize reporting before we know whether + * syslog is supposed to be on, this message will go to stdout and + * be lost when running in background. + */ if (outlevel >= O_VERBOSE) { int i; @@ -285,6 +279,17 @@ int main(int argc, char **argv) if (!(quitmode && argc == 2)) implicitmode = load_params(argc, argv, optind); +#if defined(HAVE_SYSLOG) + /* logging should be set up early in case we were restarted from exec */ + if (run.use_syslog) + { + openlog(program_name, LOG_PID, LOG_MAIL); + report_init(-1); + } + else +#endif + report_init((run.poll_interval == 0 || nodetach) && !run.logfile); + /* set up to do lock protocol */ #define FETCHMAIL_PIDFILE "fetchmail.pid" if (!getuid()) { @@ -363,11 +368,12 @@ int main(int argc, char **argv) /* perhaps we just want to check options? */ if (versioninfo) { - report(stdout, _("Taking options from command line")); - if (access(rcfile, 0)) - report(stdout, "\n"); - else - report(stdout, _(" and %s\n"), rcfile); + int havercfile = access(rcfile, 0); + + report(stdout, _("Taking options from command line%s%s\n"), + havercfile ? "" : _(" and "), + havercfile ? "" : rcfile); + if (outlevel >= O_VERBOSE) report(stdout, _("Lockfile at %s\n"), tmpbuf); |