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
Loading
Loading
Loading
Loading

changes/bug32352

0 → 100644
+6 −0
Original line number Diff line number Diff line
  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.
+6 −3
Original line number Diff line number Diff line
@@ -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);
    }
  }