changeset 15562:bc11033ef035

config: Notify process creation success to master only after parsing config file
author Timo Sirainen <tss@iki.fi>
date Tue, 18 Dec 2012 21:37:57 +0200
parents 310b3a77a9d1
children 579984fdb6e5
files src/config/main.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/config/main.c	Tue Dec 18 21:20:38 2012 +0200
+++ b/src/config/main.c	Tue Dec 18 21:37:57 2012 +0200
@@ -26,13 +26,17 @@
 	restrict_access_by_env(NULL, FALSE);
 	restrict_access_allow_coredumps(TRUE);
 
-	master_service_init_finish(master_service);
 	config_parse_load_modules();
 
 	path = master_service_get_config_path(master_service);
 	if (config_parse_file(path, TRUE, "", &error) <= 0)
 		i_fatal("%s", error);
 
+	/* notify about our success only after successfully parsing the
+	   config file, so if the parsing fails, master won't immediately
+	   just recreate this process (and fail again and so on). */
+	master_service_init_finish(master_service);
+
 	master_service_run(master_service, client_connected);
 	config_connections_destroy_all();