diff options
author | Vicent Marti <vicent@github.com> | 2014-09-05 02:50:11 +0200 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-09-05 02:50:11 +0200 |
commit | 0972443c47ba67d63d346c2775b501fc7063aaa8 (patch) | |
tree | 4f98739622caa0d8fd64125c093141b9ff30e4ed | |
parent | 89e05e2ab19ac452e84e0eaa2dfb8e07ac6839bf (diff) | |
parent | 2dc399a81da0baec54da80ed90a0007fb8caed81 (diff) | |
download | libgit2-0972443c47ba67d63d346c2775b501fc7063aaa8.tar.gz |
Merge pull request #2553 from libgit2/cmn/ssh-errors
ssh: store error message immediately after a failed agent call
-rw-r--r-- | src/transports/ssh.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/transports/ssh.c b/src/transports/ssh.c index fff81661a..a57d27d31 100644 --- a/src/transports/ssh.c +++ b/src/transports/ssh.c @@ -292,6 +292,10 @@ static int ssh_agent_auth(LIBSSH2_SESSION *session, git_cred_ssh_key *c) { } shutdown: + + if (rc != LIBSSH2_ERROR_NONE) + ssh_error(session, "error authenticating"); + libssh2_agent_disconnect(agent); libssh2_agent_free(agent); @@ -305,6 +309,7 @@ static int _git_ssh_authenticate_session( int rc; do { + giterr_clear(); switch (cred->credtype) { case GIT_CREDTYPE_USERPASS_PLAINTEXT: { git_cred_userpass_plaintext *c = (git_cred_userpass_plaintext *)cred; @@ -361,7 +366,8 @@ static int _git_ssh_authenticate_session( return GIT_EAUTH; if (rc != LIBSSH2_ERROR_NONE) { - ssh_error(session, "Failed to authenticate SSH session"); + if (!giterr_last()) + ssh_error(session, "Failed to authenticate SSH session"); return -1; } |