[dovecot-cvs] dovecot/src/master main.c,1.87,1.88

cras at dovecot.org cras at dovecot.org
Sun Jul 2 16:55:34 EEST 2006


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv3666

Modified Files:
	main.c 
Log Message:
If something in io_loop_create() failed, we logged the error to /dev/null.



Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- main.c	2 Jul 2006 11:03:58 -0000	1.87
+++ main.c	2 Jul 2006 13:55:31 -0000	1.88
@@ -509,17 +509,11 @@
 	if (!IS_INETD())
 		listen_fds_open(FALSE);
 
-	/* close stdin and stdout. close stderr unless we're logging
-	   into /dev/stderr. */
+	/* close stdin and stdout. */
 	if (dup2(null_fd, 0) < 0)
 		i_fatal("dup2(0) failed: %m");
 	if (dup2(null_fd, 1) < 0)
 		i_fatal("dup2(1) failed: %m");
-
-	if (!have_stderr(settings_root)) {
-		if (dup2(null_fd, 2) < 0)
-			i_fatal("dup2(2) failed: %m");
-	}
 }
 
 static void create_pid_file(const char *path)
@@ -542,6 +536,14 @@
 	/* 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. */
+	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");
 



More information about the dovecot-cvs mailing list