summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-05-16 11:00:12 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2014-05-28 14:28:47 +0200
commit04bc7c0e38fc77afc116031f1e25af80374b1971 (patch)
treeb16d3a7358cca4761708733a3813f0d3e7a82f17
parentd61563b2356eba9643ee711d900f0ad3c1f1f298 (diff)
downloadfocaccia-qemu-04bc7c0e38fc77afc116031f1e25af80374b1971.tar.gz
focaccia-qemu-04bc7c0e38fc77afc116031f1e25af80374b1971.zip
block/ssh: Drop superfluous libssh2_session_last_errno() calls
libssh2_session_last_error() already returns the error code.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--block/ssh.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/block/ssh.c b/block/ssh.c
index aa63c9d20e..e38d2322e9 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -121,10 +121,9 @@ session_error_report(BDRVSSHState *s, const char *fs, ...)
         char *ssh_err;
         int ssh_err_code;
 
-        libssh2_session_last_error((s)->session, &ssh_err, NULL, 0);
         /* This is not an errno.  See <libssh2.h>. */
-        ssh_err_code = libssh2_session_last_errno((s)->session);
-
+        ssh_err_code = libssh2_session_last_error(s->session,
+                                                  &ssh_err, NULL, 0);
         error_printf(": %s (libssh2 error code: %d)", ssh_err, ssh_err_code);
     }
 
@@ -145,9 +144,9 @@ sftp_error_report(BDRVSSHState *s, const char *fs, ...)
         int ssh_err_code;
         unsigned long sftp_err_code;
 
-        libssh2_session_last_error((s)->session, &ssh_err, NULL, 0);
         /* This is not an errno.  See <libssh2.h>. */
-        ssh_err_code = libssh2_session_last_errno((s)->session);
+        ssh_err_code = libssh2_session_last_error(s->session,
+                                                  &ssh_err, NULL, 0);
         /* See <libssh2_sftp.h>. */
         sftp_err_code = libssh2_sftp_last_error((s)->sftp);