dovecot-2.0: config parser: If line ends with '\' continuation, ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Dec 8 20:33:32 EET 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/05cfc267aa3d
changeset: 10426:05cfc267aa3d
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Dec 08 13:33:27 2009 -0500
description:
config parser: If line ends with '\' continuation, remove extra whitespace before it.

diffstat:

2 files changed, 10 insertions(+), 4 deletions(-)
src/config/config-parser.c  |    7 +++++--
src/lib-settings/settings.c |    7 +++++--

diffs (34 lines):

diff -r 93b3a6e63531 -r 05cfc267aa3d src/config/config-parser.c
--- a/src/config/config-parser.c	Mon Dec 07 22:44:16 2009 -0500
+++ b/src/config/config-parser.c	Tue Dec 08 13:33:27 2009 -0500
@@ -503,8 +503,11 @@ config_parse_line(struct parser_context 
 
 	if (len > 0 && line[len-1] == '\\') {
 		/* continues in next line */
-		line[len-1] = '\0';
-		str_append(full_line, line);
+		len--;
+		while (IS_WHITE(line[len-1]))
+			len--;
+		str_append_n(full_line, line, len);
+		str_append_c(full_line, ' ');
 		return CONFIG_LINE_TYPE_SKIP;
 	}
 	if (str_len(full_line) > 0) {
diff -r 93b3a6e63531 -r 05cfc267aa3d src/lib-settings/settings.c
--- a/src/lib-settings/settings.c	Mon Dec 07 22:44:16 2009 -0500
+++ b/src/lib-settings/settings.c	Tue Dec 08 13:33:27 2009 -0500
@@ -246,8 +246,11 @@ prevfile:
 
 		if (len > 0 && line[len-1] == '\\') {
 			/* continues in next line */
-			line[len-1] = '\0';
-			str_append(full_line, line);
+			len--;
+			while (IS_WHITE(line[len-1]))
+				len--;
+			str_append_n(full_line, line, len);
+			str_append_c(full_line, ' ');
 			continue;
 		}
 		if (str_len(full_line) > 0) {


More information about the dovecot-cvs mailing list