dovecot-2.0: master: Fixed log_path=/dev/stderr

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 20 22:13:00 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/d7a3abc9e0e0
changeset: 12023:d7a3abc9e0e0
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 20 20:12:51 2010 +0100
description:
master: Fixed log_path=/dev/stderr

diffstat:

 src/master/service-process.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r 807bc9ea1411 -r d7a3abc9e0e0 src/master/service-process.c
--- a/src/master/service-process.c	Fri Aug 20 19:49:42 2010 +0100
+++ b/src/master/service-process.c	Fri Aug 20 20:12:51 2010 +0100
@@ -117,7 +117,11 @@
 	}
 	dup2_append(&dups, service->status_fd[1], MASTER_STATUS_FD);
 
-	if (service->type != SERVICE_TYPE_LOG) {
+	if (service->type == SERVICE_TYPE_LOG) {
+		/* keep stderr as-is. this is especially important when
+		   log_path=/dev/stderr, but might be helpful even in other
+		   situations for logging startup errors */
+	} else {
 		/* set log file to stderr. dup2() here immediately so that
 		   we can set up logging to it without causing any log messages
 		   to be lost. */
@@ -127,8 +131,6 @@
 		if (dup2(service->log_fd[1], STDERR_FILENO) < 0)
 			i_fatal("dup2(log fd) failed: %m");
 		i_set_failure_internal();
-	} else {
-		dup2_append(&dups, null_fd, STDERR_FILENO);
 	}
 
 	/* make sure we don't leak syslog fd. try to do it as late as possible,


More information about the dovecot-cvs mailing list