[dovecot-cvs] dovecot/src/imap main.c,1.88,1.89

tss at dovecot.org tss at dovecot.org
Thu Mar 15 17:53:07 EET 2007


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv15106/imap

Modified Files:
	main.c 
Log Message:
Fixes to handling log prefixes. imap/pop3 processes now log the
mail_log_prefix even when started with --exec-mail.



Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/main.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- main.c	8 Mar 2007 22:07:38 -0000	1.88
+++ main.c	15 Mar 2007 15:53:04 -0000	1.89
@@ -97,20 +97,23 @@
 		return;
 	}
 
-	user = getenv("USER");
-	if (user == NULL) {
-		if (IS_STANDALONE())
-			user = getlogin();
-		if (user == NULL)
-			user = "??";
-	}
-	if (strlen(user) >= sizeof(log_prefix)-6) {
-		/* quite a long user name, cut it */
-		user = t_strndup(user, sizeof(log_prefix)-6-2);
-		user = t_strconcat(user, "..", NULL);
+	if (getenv("LOG_PREFIX") != NULL)
+		strocpy(log_prefix, getenv("LOG_PREFIX"), sizeof(log_prefix));
+	else {
+		user = getenv("USER");
+		if (user == NULL) {
+			if (IS_STANDALONE())
+				user = getlogin();
+			if (user == NULL)
+				user = "??";
+		}
+		if (strlen(user) >= sizeof(log_prefix)-6) {
+			/* quite a long user name, cut it */
+			user = t_strndup(user, sizeof(log_prefix)-6-2);
+			user = t_strconcat(user, "..", NULL);
+		}
+		i_snprintf(log_prefix, sizeof(log_prefix), "imap(%s): ", user);
 	}
-	i_snprintf(log_prefix, sizeof(log_prefix), "imap(%s)", user);
-
 	if (getenv("USE_SYSLOG") != NULL) {
 		const char *env = getenv("SYSLOG_FACILITY");
 		i_set_failure_syslog(log_prefix, LOG_NDELAY,



More information about the dovecot-cvs mailing list