dovecot: Reordered initialization code. Capabilities are now dro...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 28 02:13:22 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/5d0aa827f130
changeset: 5824:5d0aa827f130
user:      root at hurina
date:      Thu Jun 28 02:13:07 2007 +0300
description:
Reordered initialization code. Capabilities are now dropped as soon as
possible.

diffstat:

1 file changed, 5 insertions(+), 9 deletions(-)
src/master/main.c |   14 +++++---------

diffs (45 lines):

diff -r c1b32cd98e68 -r 5d0aa827f130 src/master/main.c
--- a/src/master/main.c	Thu Jun 28 02:12:19 2007 +0300
+++ b/src/master/main.c	Thu Jun 28 02:13:07 2007 +0300
@@ -571,29 +571,24 @@ static void create_pid_file(const char *
 
 static void main_init(bool log_error)
 {
+	drop_capabilities();
+
 	/* deny file access from everyone else except owner */
         (void)umask(0077);
 
-	/* close stderr unless we're logging into /dev/stderr. keep as little
-	   distance between closing it and opening the actual log file so that
-	   we don't lose anything. */
+	set_logfile(settings_root->defaults);
+	/* close stderr unless we're logging into /dev/stderr. */
 	if (!have_stderr(settings_root)) {
 		if (dup2(null_fd, 2) < 0)
 			i_fatal("dup2(2) failed: %m");
 	}
-
-	set_logfile(settings_root->defaults);
 	i_info("Dovecot v"VERSION" starting up");
-
-	log_init();
 
 	if (log_error) {
 		i_warning("This is Dovecot's warning log");
 		i_error("This is Dovecot's error log");
 		i_fatal("This is Dovecot's fatal log");
 	}
-
-	drop_capabilities();
 
 	lib_signals_init();
         lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL);
@@ -606,6 +601,7 @@ static void main_init(bool log_error)
 	pids = hash_create(default_pool, default_pool, 128, NULL, NULL);
 	lib_signals_set_handler(SIGCHLD, TRUE, sigchld_handler, NULL);
 
+	log_init();
 	ssl_init();
 	dict_process_init();
 	auth_processes_init();


More information about the dovecot-cvs mailing list