From 897e3a72515562699f2d2c9bd24d8c16010596cf Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 9 Jan 2000 07:10:21 +0000 Subject: Fixed the syslog problem. svn path=/trunk/; revision=2706 --- fetchmail.c | 38 ++++++++++++++++++++++---------------- fetchmail.man | 6 ++++++ 2 files changed, 28 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); diff --git a/fetchmail.man b/fetchmail.man index e9ffbc5d..87a16229 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -1944,6 +1944,12 @@ MDA. For maximum safety, however, don't use an mda command containing Fetchmail's method of sending bouncemail requires that port 25 of localhost be available for sending mail via SMTP. .PP +If you modify a +.I .fetchmailrc +while a background instance is running and break the syntax, the +background instance will die silently. Unfortunately, it can't +die noisily because we don't yet know whether syslog should be enabled. +.PP Send comments, bug reports, gripes, and the like to the fetchmail-friends list . An HTML FAQ is available at the fetchmail home page; surf to -- cgit v1.2.3