mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-18 23:10:39 +00:00
config_cache: check return value of git_config__lookup_entry
Callers of `git_config__cvar` already handle the case where the function returns an error due to a failed configuration variable lookup, but we are actually swallowing errors when calling `git_config__lookup_entry` inside of the function. Fix this by returning early when `git_config__lookup_entry` returns an error. As we call `git_config__lookup_entry` with `no_errors == false` which leads us to call `get_entry` with `GET_NO_MISSING` we will not return early when the lookup fails due to a missing entry. Like this we are still able to set the default value of the cvar and exit successfully.
This commit is contained in:
parent
6ff8a7c4be
commit
13c371dc10
@ -86,7 +86,8 @@ int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar)
|
|||||||
struct map_data *data = &_cvar_maps[(int)cvar];
|
struct map_data *data = &_cvar_maps[(int)cvar];
|
||||||
git_config_entry *entry;
|
git_config_entry *entry;
|
||||||
|
|
||||||
git_config__lookup_entry(&entry, config, data->cvar_name, false);
|
if ((error = git_config__lookup_entry(&entry, config, data->cvar_name, false)) < 0)
|
||||||
|
return error;
|
||||||
|
|
||||||
if (!entry)
|
if (!entry)
|
||||||
*out = data->default_value;
|
*out = data->default_value;
|
||||||
|
Loading…
Reference in New Issue
Block a user