summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Germishuys <jacquesg@striata.com>2014-12-24 11:43:38 +0200
committerJacques Germishuys <jacquesg@striata.com>2014-12-30 12:33:39 +0200
commit3dbd9a0e86f30e1192fd76ce98c9fbce1801a1d9 (patch)
treeca1ca64c733fb8344eb58748247e4f055ef5e1c5
parent6f73e02605f57db20b8713053d55fef4b534f07b (diff)
downloadlibgit2-3dbd9a0e86f30e1192fd76ce98c9fbce1801a1d9.tar.gz
Check the result of git_buf_joinpath
-rw-r--r--src/rebase.c3
-rw-r--r--src/repository.c10
2 files changed, 9 insertions, 4 deletions
diff --git a/src/rebase.c b/src/rebase.c
index 0c84a480a..ceb74d39f 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -592,7 +592,8 @@ static int rebase_init(
git_buf state_path = GIT_BUF_INIT;
int error;
- git_buf_joinpath(&state_path, repo->path_repository, REBASE_MERGE_DIR);
+ if ((error = git_buf_joinpath(&state_path, repo->path_repository, REBASE_MERGE_DIR)) < 0)
+ return error;
rebase->repo = repo;
rebase->type = GIT_REBASE_TYPE_MERGE;
diff --git a/src/repository.c b/src/repository.c
index 74a966ef3..0cf8eb66b 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -656,7 +656,8 @@ int git_repository_odb__weakptr(git_odb **out, git_repository *repo)
git_buf odb_path = GIT_BUF_INIT;
git_odb *odb;
- git_buf_joinpath(&odb_path, repo->path_repository, GIT_OBJECTS_DIR);
+ if ((error = git_buf_joinpath(&odb_path, repo->path_repository, GIT_OBJECTS_DIR)) < 0)
+ return error;
error = git_odb_open(&odb, odb_path.ptr);
if (!error) {
@@ -741,7 +742,8 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo)
git_buf index_path = GIT_BUF_INIT;
git_index *index;
- git_buf_joinpath(&index_path, repo->path_repository, GIT_INDEX_FILE);
+ if ((error = git_buf_joinpath(&index_path, repo->path_repository, GIT_INDEX_FILE)) < 0)
+ return error;
error = git_index_open(&index, index_path.ptr);
if (!error) {
@@ -2068,7 +2070,9 @@ int git_repository_is_shallow(git_repository *repo)
struct stat st;
int error;
- git_buf_joinpath(&path, repo->path_repository, "shallow");
+ if ((error = git_buf_joinpath(&path, repo->path_repository, "shallow")) < 0)
+ return error;
+
error = git_path_lstat(path.ptr, &st);
git_buf_free(&path);