Commit 04503173 by Stewart Brodie Committed by Stéphane Graber

Allow configuration file values to be quoted

If the value starts and ends with matching quote characters, those characters are stripped automatically. Quote characters are the single quote (') or double quote ("). The quote removal is done after the whitespace trimming. This is needed particularly in order that lxc.environment values may have trailing spaces. However, the quote removal is done for all values in the parse_line function, as it has non-const access to the value. Signed-off-by: 's avatarStewart Brodie <stewart@metahusky.net>
parent 015d4e48
...@@ -1964,6 +1964,14 @@ static int parse_line(char *buffer, void *data) ...@@ -1964,6 +1964,14 @@ static int parse_line(char *buffer, void *data)
value += lxc_char_left_gc(value, strlen(value)); value += lxc_char_left_gc(value, strlen(value));
value[lxc_char_right_gc(value, strlen(value))] = '\0'; value[lxc_char_right_gc(value, strlen(value))] = '\0';
if (*value == '\'' || *value == '\"') {
size_t len = strlen(value);
if (len > 1 && value[len-1] == *value) {
value[len-1] = '\0';
value++;
}
}
config = lxc_getconfig(key); config = lxc_getconfig(key);
if (!config) { if (!config) {
ERROR("unknown key %s", key); ERROR("unknown key %s", key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment