aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-07-05 02:36:22 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-07-05 02:43:15 +0300
commit276a61672a0b10d797225e8d1e4e4abf283a3249 (patch)
treef0f21877905fe37f7d6ab137fefc588d3243eb7b /src/main.c
parentca41c27a800586fb440da8a35b623292bed8c128 (diff)
downloadmailfromd-276a61672a0b10d797225e8d1e4e4abf283a3249.tar.gz
mailfromd-276a61672a0b10d797225e8d1e4e4abf283a3249.tar.bz2
Improve reporting of startup errors. HUP restarts the program only if syntax check succeeds.
* lib/libmf.h (mf_server_lint_option): New extern. * lib/server.c (mf_server_lint_option): New global variable. (sig_restart): Don't call mfd_srvman_stop. (run_lint,server_idle_hook): New functions. (mf_server_start): Install idle hook. HUP restarts the program only if syntax check succeeds. Close fds above 2 if using stderr for error output, and from 1 if using syslog. * src/calloutd.c (main): Call mu_stdstream_setup. Set mf_server_lint_option. * src/main.c (main): Check whether stderr is open as early as possible. Update call to mu_stdstream_setup (needs MU 5e1d982ec). Set mf_server_lint_option. * src/srvcfg.c (srv_parse_opt): Make sure --syslog takes effect at once.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 090be692..cc0852df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1166,6 +1166,7 @@ main(int argc, char **argv)
int index;
prog_counter_t entry_point;
struct arguments args;
+ int stderr_is_closed = stderr_closed_p();
mf_init_nls();
mf_proctitle_init(argc, argv, environ);
@@ -1182,8 +1183,8 @@ main(int argc, char **argv)
mu_set_program_name(argv[0]);
mu_log_tag = (char*)mu_program_name;
mu_log_facility = DEFAULT_LOG_FACILITY;
- mu_stdstream_setup ();
- mf_srvcfg_log_setup(stderr_closed_p() ? "syslog" : "stderr");
+ mu_stdstream_setup(MU_STDSTREAM_RESET_NONE);
+ mf_srvcfg_log_setup(stderr_is_closed ? "syslog" : "stderr");
debug_init(modnames);
libcallout_init();
@@ -1329,6 +1330,7 @@ main(int argc, char **argv)
server_flags |= MF_SERVER_NORESTART;
}
open_strecho(1);
+ mf_server_lint_option = "--lint";
mf_server_start("mailfromd", mailfromd_state_dir, pidfile,
server_flags);
break;

Return to:

Send suggestions and report system problems to the System administrator.