diff options
author | Congyi Wu <congyiwu@gmail.com> | 2013-01-28 16:13:19 -0500 |
---|---|---|
committer | Congyi Wu <congyiwu@gmail.com> | 2013-01-28 16:56:56 -0500 |
commit | 96447d24f32052bf2755085eaab491e8f3ec9f56 (patch) | |
tree | 70c18e9648cab6b72dc82edc219b9bbcb5b24fea | |
parent | e1859ea184a0a440b83d6c9cdb7827031b037e92 (diff) | |
download | libgit2-96447d24f32052bf2755085eaab491e8f3ec9f56.tar.gz |
Fix 2 bugs in online::push tests.
- Fix stack corruption introduced in 9bccf33c due to passing pointer to
local variable _cred_acquire_called.
- Fix strcmp in do_verify_push_status when expected or actual push_status
is NULL
-rw-r--r-- | tests-clar/online/push.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests-clar/online/push.c b/tests-clar/online/push.c index 3e2e33462..8f92cdd5e 100644 --- a/tests-clar/online/push.c +++ b/tests-clar/online/push.c @@ -14,6 +14,7 @@ static char *_remote_user; static char *_remote_pass; static git_remote *_remote; +static bool _cred_acquire_called; static record_callbacks_data _record_cbs_data = {{ 0 }}; static git_remote_callbacks _record_cbs = RECORD_CALLBACKS_INIT(&_record_cbs_data); @@ -79,7 +80,9 @@ static void do_verify_push_status(git_push *push, const push_status expected[], else git_vector_foreach(&actual, i, iter) if (strcmp(expected[i].ref, iter->ref) || - (expected[i].msg && strcmp(expected[i].msg, iter->msg))) { + (expected[i].msg && !iter->msg) || + (!expected[i].msg && iter->msg) || + (expected[i].msg && iter->msg && strcmp(expected[i].msg, iter->msg))) { failed = true; break; } @@ -231,7 +234,7 @@ void test_online_push__initialize(void) git_vector delete_specs = GIT_VECTOR_INIT; size_t i; char *curr_del_spec; - bool cred_acquire_called = false; + _cred_acquire_called = false; _repo = cl_git_sandbox_init("push_src"); @@ -272,7 +275,7 @@ void test_online_push__initialize(void) if (_remote_url) { cl_git_pass(git_remote_create(&_remote, _repo, "test", _remote_url)); - git_remote_set_cred_acquire_cb(_remote, cred_acquire_cb, &cred_acquire_called); + git_remote_set_cred_acquire_cb(_remote, cred_acquire_cb, &_cred_acquire_called); record_callbacks_data_clear(&_record_cbs_data); git_remote_set_callbacks(_remote, &_record_cbs); |