Skip to content
Snippets Groups Projects
Commit f29de4b8 authored by teor's avatar teor
Browse files

confmgt: Stop adding a space, when there is no option value

Fixes bug 32352; bugfix on 0.0.9pre6.
parent 5d85c247
Branches bug_40061
No related tags found
No related merge requests found
o Minor bugfixes (config):
- When dumping the config, stop adding a trailing space after the option
name, when there is no option value. This issue only affects options
that accept an empty value or list. (Most options reject empty values,
or delete the entire line from the dumped options.)
Fixes bug 32352; bugfix on 0.0.9pre6.
......@@ -1307,9 +1307,10 @@ config_dump(const config_mgr_t *mgr, const void *default_options,
*/
continue;
}
smartlist_add_asprintf(elements, "%s%s %s\n",
int value_exists = line->value && *(line->value);
smartlist_add_asprintf(elements, "%s%s%s%s\n",
comment_option ? "# " : "",
line->key, line->value);
line->key, value_exists ? " " : "", line->value);
}
config_free_lines(assigned);
} SMARTLIST_FOREACH_END(mv);
......@@ -1317,7 +1318,9 @@ config_dump(const config_mgr_t *mgr, const void *default_options,
if (fmt->extra) {
line = *(config_line_t**)STRUCT_VAR_P(options, fmt->extra->offset);
for (; line; line = line->next) {
smartlist_add_asprintf(elements, "%s %s\n", line->key, line->value);
int value_exists = line->value && *(line->value);
smartlist_add_asprintf(elements, "%s%s%s\n",
line->key, value_exists ? " " : "", line->value);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment