Skip to content

Commit

Permalink
config: Fix checking if <path needs to be expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and GitLab committed Jan 9, 2017
1 parent 3bb6114 commit 3fae65c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/config/config-parser.c
Expand Up @@ -780,23 +780,24 @@ static int config_write_value(struct config_parser_context *ctx,
string_t *str = ctx->str;
const void *var_name, *var_value, *p;
enum setting_type var_type;
const char *error, *path;
const char *error, *path, *full_key;
bool dump, expand_parent;

switch (type) {
case CONFIG_LINE_TYPE_KEYVALUE:
str_append(str, value);
break;
case CONFIG_LINE_TYPE_KEYFILE:
full_key = t_strndup(str_data(ctx->str), str_len(str)-1);
if (!ctx->expand_values) {
str_append_c(str, '<');
str_append(str, value);
} else {
if (!config_require_key(ctx, key)) {
if (!config_require_key(ctx, full_key)) {
/* don't even try to open the file */
} else {
path = fix_relative_path(value, ctx->cur_input);
if (str_append_file(str, key, path, &error) < 0) {
if (str_append_file(str, full_key, path, &error) < 0) {
/* file reading failed */
ctx->error = p_strdup(ctx->pool, error);
return -1;
Expand Down

0 comments on commit 3fae65c

Please sign in to comment.