X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=config.c;h=49e5250dc5384a012dc828d156cbf8686db9d0bb;hb=52b195f2b8e0d8c9d4583aab44846698ed3149f2;hp=e0b3b80d92ece9f37e0e76292bd61ce97271fcce;hpb=8fba5f985263efd46e94f392ce618de6adc1c3d5;p=git.git diff --git a/config.c b/config.c index e0b3b80d9..49e5250dc 100644 --- a/config.c +++ b/config.c @@ -42,10 +42,10 @@ void git_config_push_parameter(const char *text) static int git_config_parse_parameter(const char *text, config_fn_t fn, void *data) { - struct strbuf tmp = STRBUF_INIT; struct strbuf **pair; - strbuf_addstr(&tmp, text); - pair = strbuf_split(&tmp, '='); + pair = strbuf_split_str(text, '=', 2); + if (!pair[0]) + return error("bogus config parameter: %s", text); if (pair[0]->len && pair[0]->buf[pair[0]->len - 1] == '=') strbuf_setlen(pair[0], pair[0]->len - 1); strbuf_trim(pair[0]); @@ -856,7 +856,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config) switch (git_config_from_parameters(fn, data)) { case -1: /* error */ - ret--; + die("unable to parse command-line config"); break; case 0: /* found nothing */ break; @@ -1479,10 +1479,10 @@ int git_config_rename_section(const char *old_name, const char *new_name) } } fclose(config_file); - unlock_and_out: +unlock_and_out: if (commit_lock_file(lock) < 0) ret = error("could not commit config file %s", config_filename); - out: +out: free(config_filename); return ret; }