From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkVDt-0007tM-3J for qemu-devel@nongnu.org; Wed, 14 May 2014 05:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkVDn-0003hD-L7 for qemu-devel@nongnu.org; Wed, 14 May 2014 05:11:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkVDn-0003h8-Bf for qemu-devel@nongnu.org; Wed, 14 May 2014 05:11:31 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4E9BTFR028015 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 14 May 2014 05:11:30 -0400 Date: Wed, 14 May 2014 10:11:27 +0100 From: "Richard W.M. Jones" Message-ID: <20140514091127.GO1302@redhat.com> References: <1399996972-23429-1-git-send-email-armbru@redhat.com> <1399996972-23429-6-git-send-email-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1399996972-23429-6-git-send-email-armbru@redhat.com> Subject: Re: [Qemu-devel] [PATCH 05/18] block/ssh: Drop superfluous libssh2_session_last_errno() calls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com 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" > Signed-off-by: Markus Armbruster > --- > 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 . */ > - 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 . */ > - ssh_err_code = libssh2_session_last_errno((s)->session); > + ssh_err_code = libssh2_session_last_error(s->session, > + &ssh_err, NULL, 0); > /* See . */ > 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. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top