dovecot-2.0: doveconf: Config file warning check should use base...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 14 21:20:18 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/1f006c9e5795
changeset: 11544:1f006c9e5795
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 14 19:20:02 2010 +0100
description:
doveconf: Config file warning check should use base_dir, not PKG_RUNDIR.

diffstat:

 src/config/doveconf.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 356afa6263d4 -r 1f006c9e5795 src/config/doveconf.c
--- a/src/config/doveconf.c	Mon Jun 14 18:51:17 2010 +0100
+++ b/src/config/doveconf.c	Mon Jun 14 19:20:02 2010 +0100
@@ -436,7 +436,7 @@
 	} T_END;
 }
 
-static const char *get_mail_location(void)
+static const char *get_setting(const char *module, const char *name)
 {
 	struct config_module_parser *l;
 	const struct setting_define *def;
@@ -444,12 +444,12 @@
 	const void *set;
 
 	for (l = config_module_parsers; l->root != NULL; l++) {
-		if (strcmp(l->root->module_name, "mail") != 0)
+		if (strcmp(l->root->module_name, module) != 0)
 			continue;
 
 		set = settings_parser_get(l->parser);
 		for (def = l->root->defines; def->key != NULL; def++) {
-			if (strcmp(def->key, "mail_location") == 0) {
+			if (strcmp(def->key, name) == 0) {
 				value = CONST_PTR_OFFSET(set, def->offset);
 				return *value;
 			}
@@ -491,9 +491,11 @@
 
 static void check_wrong_config(const char *config_path)
 {
-	const char *prev_path;
+	const char *base_dir, *symlink_path, *prev_path;
 
-	if (t_readlink(PKG_RUNDIR"/"PACKAGE".conf", &prev_path) < 0)
+	base_dir = get_setting("master", "base_dir");
+	symlink_path = t_strconcat(base_dir, "/"PACKAGE".conf", NULL);
+	if (t_readlink(symlink_path, &prev_path) < 0)
 		return;
 
 	if (strcmp(prev_path, config_path) != 0) {
@@ -586,7 +588,7 @@
 	} else if (exec_args == NULL) {
 		const char *info;
 
-		info = sysinfo_get(get_mail_location());
+		info = sysinfo_get(get_setting("mail", "mail_location"));
 		if (*info != '\0')
 			printf("# %s\n", info);
 		if (!config_path_specified)


More information about the dovecot-cvs mailing list