changeset 4454:a75da1185a18 HEAD

Allow log_path settings in config file to be empty without trying to use empty files then.
author Timo Sirainen <tss@iki.fi>
date Wed, 28 Jun 2006 23:21:43 +0300
parents 85fcdb478608
children fce5140fbe0b
files src/deliver/deliver.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/deliver/deliver.c	Wed Jun 28 19:31:05 2006 +0300
+++ b/src/deliver/deliver.c	Wed Jun 28 23:21:43 2006 +0300
@@ -317,20 +317,22 @@
 
 static void open_logfile(const char *username)
 {
-	const char *prefix;
+	const char *prefix, *log_path;
 
 	prefix = t_strdup_printf("deliver(%s)", username);
-	if (getenv("LOG_PATH") == NULL) {
+	log_path = getenv("LOG_PATH");
+	if (log_path == NULL || *log_path == '\0') {
 		const char *env = getenv("SYSLOG_FACILITY");
 		i_set_failure_syslog(prefix, LOG_NDELAY,
 				     env == NULL ? LOG_MAIL : atoi(env));
 	} else {
 		/* log to file or stderr */
-		i_set_failure_file(getenv("LOG_PATH"), prefix);
+		i_set_failure_file(log_path, prefix);
 	}
 
-	if (getenv("INFO_LOG_PATH") != NULL)
-		i_set_info_file(getenv("INFO_LOG_PATH"));
+	log_path = getenv("INFO_LOG_PATH");
+	if (log_path != NULL && *log_path != '\0')
+		i_set_info_file(log_path);
 
 	i_set_failure_timestamp_format(getenv("LOG_TIMESTAMP"));
 }