[dovecot-cvs] dovecot/src/master settings.c,1.25,1.26

cras at procontrol.fi cras at procontrol.fi
Tue Dec 3 15:31:41 EET 2002


Update of /home/cvs/dovecot/src/master
In directory danu:/tmp/cvs-serv17098

Modified Files:
	settings.c 
Log Message:
We should verify existance of log directory, not the file itself.



Index: settings.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/settings.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- settings.c	1 Dec 2002 21:51:43 -0000	1.25
+++ settings.c	3 Dec 2002 13:31:39 -0000	1.26
@@ -169,9 +169,24 @@
 	}
 }
 
+static const char *get_directory(const char *path)
+{
+	char *str, *p;
+
+	str = t_strdup_noconst(path);
+	p = strrchr(str, '/');
+	if (p == NULL)
+		return ".";
+	else {
+		*p = '\0';
+		return str;
+	}
+}
+
 static void settings_verify(void)
 {
 	char *const *str;
+	const char *dir;
 	int dotlock_got, fcntl_got, flock_got;
 
 	get_login_uid();
@@ -187,10 +202,11 @@
 	}
 
 	if (set_log_path != NULL) {
-		if (access(set_log_path, W_OK) < 0) {
-			i_fatal("Can't access log directory %s: %m",
-				set_log_path);
-		}
+		/* log_path specifies a full file,  */
+		dir = get_directory(set_log_path);
+
+		if (access(dir, W_OK) < 0)
+			i_fatal("Can't access log directory %s: %m", dir);
 	}
 
 #ifdef HAVE_SSL




More information about the dovecot-cvs mailing list