[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 05/18] block/ssh: Drop superfluous libssh2_sessi
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 05/18] block/ssh: Drop superfluous libssh2_session_last_errno() calls |
Date: |
Wed, 14 May 2014 13:06:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
"Richard W.M. Jones" <address@hidden> writes:
> On Tue, May 13, 2014 at 06:02:39PM +0200, Markus Armbruster wrote:
>> libssh2_session_last_error() already returns the error code.
>>
>> Cc: "Richard W.M. Jones" <address@hidden>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>> block/ssh.c | 9 ++++-----
>> 1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/block/ssh.c b/block/ssh.c
>> index aa63c9d..e38d232 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);
>
> Yes, I'm not quite sure what was happening here. I checked the source
> of libssh2 and as you say, libssh2_session_last_error returns the
> error code, so there is no need to call libssh2_session_last_errno as
> well.
>
> Therefore, ACK.
Did you review the patch? If yes, I'd like to convert your ACK to a
formal Reviewed-by. Same for PATCH 06-09.
[Qemu-devel] [PATCH 10/18] block/vvfat: Propagate errors through enable_write_target(), Markus Armbruster, 2014/05/13
[Qemu-devel] [PATCH 07/18] block/ssh: Propagate errors through authenticate(), Markus Armbruster, 2014/05/13
[Qemu-devel] [PATCH 06/18] block/ssh: Propagate errors through check_host_key(), Markus Armbruster, 2014/05/13