dovecot-1.3: Sort environment for settings in reverse order, or ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Apr 12 04:46:37 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.3/rev/c77a3902dc5e
changeset: 9074:c77a3902dc5e
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Apr 11 21:46:32 2009 -0400
description:
Sort environment for settings in reverse order, or it won't work..

diffstat:

1 file changed, 8 insertions(+), 1 deletion(-)
src/lib-settings/settings-parser.c |    9 ++++++++-

diffs (26 lines):

diff -r dc3739ee4123 -r c77a3902dc5e src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c	Sat Apr 11 21:41:42 2009 -0400
+++ b/src/lib-settings/settings-parser.c	Sat Apr 11 21:46:32 2009 -0400
@@ -565,6 +565,13 @@ int settings_parse_file(struct setting_p
 	return ret;
 }
 
+static int environ_cmp(const void *p1, const void *p2)
+{
+	const char *const *s1 = p1, *const *s2 = p2;
+
+	return -strcmp(*s1, *s2);
+}
+
 int settings_parse_environ(struct setting_parser_context *ctx)
 {
 	extern char **environ;
@@ -581,7 +588,7 @@ int settings_parse_environ(struct settin
 	for (i = 0; environ[i] != NULL; i++)
 		array_append(&sorted_envs_arr, &environ[i], 1);
 	sorted_envs = array_get_modifiable(&sorted_envs_arr, &count);
-	qsort(sorted_envs, count, sizeof(*sorted_envs), i_strcmp_p);
+	qsort(sorted_envs, count, sizeof(*sorted_envs), environ_cmp);
 
 	for (i = 0; i < count && ret == 0; i++) {
 		value = strchr(sorted_envs[i], '=');


More information about the dovecot-cvs mailing list