Commit 9fac8b78 by Patrick Steinhardt

config_file: do not refresh read-only backends

If calling `config_refresh` on a read-only configuration file backend,
then we will segfault when comparing the timestamp of the file due to
`path` being uninitialized. As a read-only snapshot should not be
refreshed anyway and stay consistent, we can simply return early when
calling `config_refresh` on a read-only snapshot.
parent 28d11b59
......@@ -231,8 +231,10 @@ static int config_refresh(git_config_backend *cfg)
git_config_entries *entries = NULL;
int error, modified;
error = config_is_modified(&modified, &b->file);
if (error < 0 && error != GIT_ENOTFOUND)
if (cfg->readonly)
return 0;
if ((error = config_is_modified(&modified, &b->file)) < 0 && error != GIT_ENOTFOUND)
goto out;
if (!modified)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment