diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-06-04 17:31:42 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-06-04 17:31:42 +0200 |
commit | 57cb1179e5c9c8f5c27c9115f13f1cae5d0f87a0 (patch) | |
tree | 67871086b1437dcd410979b423cd3ba140ab9257 /src/repository.c | |
parent | 90befde4a1938641dfdb9a7bdb9f361d1de5c26f (diff) | |
download | libgit2-cmn/config-default-snapshot.tar.gz |
Make the default repository config getter return a snapshotcmn/config-default-snapshot
You should always use a snapshot, with the sole exception of writing to
the configuration.
Any reads that are not against a snapshot have race conditions, both in
terms of returned values as well as dangling pointers.
Diffstat (limited to 'src/repository.c')
-rw-r--r-- | src/repository.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/repository.c b/src/repository.c index e8d50aed3..709506486 100644 --- a/src/repository.c +++ b/src/repository.c @@ -462,7 +462,7 @@ int git_repository_open_ext( else { git_config *config = NULL; - if ((error = git_repository_config_snapshot(&config, repo)) < 0 || + if ((error = git_repository_config(&config, repo)) < 0 || (error = load_config_data(repo, config)) < 0 || (error = load_workdir(repo, config, &parent)) < 0) git_repository_free(repo); @@ -616,7 +616,7 @@ int git_repository_config__weakptr(git_config **out, git_repository *repo) return error; } -int git_repository_config(git_config **out, git_repository *repo) +int git_repository_config_writable(git_config **out, git_repository *repo) { if (git_repository_config__weakptr(out, repo) < 0) return -1; @@ -625,7 +625,7 @@ int git_repository_config(git_config **out, git_repository *repo) return 0; } -int git_repository_config_snapshot(git_config **out, git_repository *repo) +int git_repository_config(git_config **out, git_repository *repo) { int error; git_config *weak; |