changeset 10026:4442b6aa5a66 HEAD

config: key="<value" shouldn't treat value as file.
author Timo Sirainen <tss@iki.fi>
date Fri, 09 Oct 2009 19:05:47 -0400
parents 6556754b6c24
children 940d11bc5039
files src/config/config-parser.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/config/config-parser.c	Fri Oct 09 18:45:29 2009 -0400
+++ b/src/config/config-parser.c	Fri Oct 09 19:05:47 2009 -0400
@@ -406,6 +406,7 @@
 	CONFIG_LINE_TYPE_SKIP,
 	CONFIG_LINE_TYPE_ERROR,
 	CONFIG_LINE_TYPE_KEYVALUE,
+	CONFIG_LINE_TYPE_KEYFILE,
 	CONFIG_LINE_TYPE_SECTION_BEGIN,
 	CONFIG_LINE_TYPE_SECTION_END,
 	CONFIG_LINE_TYPE_INCLUDE,
@@ -489,6 +490,11 @@
 		*line++ = '\0';
 		while (IS_WHITE(*line)) line++;
 
+		if (*line == '<') {
+			*value_r = line + 1;
+			return CONFIG_LINE_TYPE_KEYFILE;
+		}
+
 		len = strlen(line);
 		if (len > 0 &&
 		    ((*line == '"' && line[len-1] == '"') ||
@@ -612,13 +618,14 @@
 			errormsg = value;
 			break;
 		case CONFIG_LINE_TYPE_KEYVALUE:
+		case CONFIG_LINE_TYPE_KEYFILE:
 			str_truncate(str, pathlen);
 			str_append(str, key);
 			str_append_c(str, '=');
 
-			if (*value != '<' || !expand_files)
+			if (type != CONFIG_LINE_TYPE_KEYFILE || !expand_files)
 				str_append(str, value);
-			else if (str_append_file(str, key, value+1, &errormsg) < 0) {
+			else if (str_append_file(str, key, value, &errormsg) < 0) {
 				/* file reading failed */
 				break;
 			}