dovecot-2.0: master process shouldn't log to stderr. Changed the...

dovecot at dovecot.org dovecot at dovecot.org
Thu May 21 21:40:03 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/0dbc2dc0877c
changeset: 9345:0dbc2dc0877c
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 21 14:39:55 2009 -0400
description:
master process shouldn't log to stderr. Changed the lib-master flag to _DONT_LOG_TO_STDERR.

diffstat:

4 files changed, 10 insertions(+), 8 deletions(-)
src/lib-master/master-service.c |    4 ++--
src/lib-master/master-service.h |    5 +++--
src/master/main.c               |    5 ++++-
src/util/doveadm.c              |    4 +---

diffs (65 lines):

diff -r d6eda52bd74b -r 0dbc2dc0877c src/lib-master/master-service.c
--- a/src/lib-master/master-service.c	Thu May 21 12:59:30 2009 -0400
+++ b/src/lib-master/master-service.c	Thu May 21 14:39:55 2009 -0400
@@ -108,7 +108,6 @@ master_service_init(const char *name, en
 		service->socket_count = 1;
 	} else {
 		service->version_string = PACKAGE_VERSION;
-		service->flags |= MASTER_SERVICE_FLAG_LOG_TO_STDERR;
 	}
 	str = getenv("SOCKET_COUNT");
 	if (str != NULL)
@@ -137,7 +136,8 @@ void master_service_init_log(struct mast
 {
 	const char *path;
 
-	if ((service->flags & MASTER_SERVICE_FLAG_LOG_TO_STDERR) != 0) {
+	if ((service->flags & MASTER_SERVICE_FLAG_STANDALONE) != 0 &&
+	    (service->flags & MASTER_SERVICE_FLAG_DONT_LOG_TO_STDERR) == 0) {
 		i_set_failure_file("/dev/stderr", "");
 		return;
 	}
diff -r d6eda52bd74b -r 0dbc2dc0877c src/lib-master/master-service.h
--- a/src/lib-master/master-service.h	Thu May 21 12:59:30 2009 -0400
+++ b/src/lib-master/master-service.h	Thu May 21 14:39:55 2009 -0400
@@ -8,8 +8,9 @@ enum master_service_flags {
 	MASTER_SERVICE_FLAG_STD_CLIENT		= 0x01,
 	/* this process is currently running standalone without a master */
 	MASTER_SERVICE_FLAG_STANDALONE		= 0x02,
-	/* Log to stderr instead of the configured log file */
-	MASTER_SERVICE_FLAG_LOG_TO_STDERR	= 0x04,
+	/* Log to configured log file instead of stderr. By default when
+	   _FLAG_STANDALONE is set, logging is done to stderr. */
+	MASTER_SERVICE_FLAG_DONT_LOG_TO_STDERR	= 0x04,
 	/* Service is going to do multiple configuration lookups,
 	   keep the connection to config service open. */
 	MASTER_SERVICE_FLAG_KEEP_CONFIG_OPEN	= 0x08
diff -r d6eda52bd74b -r 0dbc2dc0877c src/master/main.c
--- a/src/master/main.c	Thu May 21 12:59:30 2009 -0400
+++ b/src/master/main.c	Thu May 21 14:39:55 2009 -0400
@@ -569,7 +569,10 @@ int main(int argc, char *argv[])
 	else
 		child_process_env[child_process_env_idx++] = "GDB=1";
 #endif
-	master_service = master_service_init("master", 0, argc, argv);
+	master_service = master_service_init("master",
+				MASTER_SERVICE_FLAG_STANDALONE |
+				MASTER_SERVICE_FLAG_DONT_LOG_TO_STDERR,
+				argc, argv);
 	i_set_failure_prefix("");
 
 	master_uid = geteuid();
diff -r d6eda52bd74b -r 0dbc2dc0877c src/util/doveadm.c
--- a/src/util/doveadm.c	Thu May 21 12:59:30 2009 -0400
+++ b/src/util/doveadm.c	Thu May 21 14:39:55 2009 -0400
@@ -213,9 +213,7 @@ int main(int argc, char *argv[])
 	bool all_users = FALSE;
 	int c;
 
-	service = master_service_init("doveadm",
-				      MASTER_SERVICE_FLAG_STANDALONE |
-				      MASTER_SERVICE_FLAG_LOG_TO_STDERR,
+	service = master_service_init("doveadm", MASTER_SERVICE_FLAG_STANDALONE,
 				      argc, argv);
 
 	username = getenv("USER");


More information about the dovecot-cvs mailing list