ssh: Remove unnecessary use of strlen function.
PATCH 1/1 ssh: Remove unnecessary use of strlen function.
From: "Richard W.M. Jones" <[email protected]>
--- block/ssh.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
block/ssh.c +2 -4
@@ -387,15 +387,13 @@ static int check_host_key(BDRVSSHState *s, const char *host, int port, }/* host_key_check=md5:xx:yy:zz:... */ -if (strlen (host_key_check) >=4 && -strncmp (host_key_check,"md5:" ,4 ) ==0 ) { +if (strncmp (host_key_check,"md5:" ,4 ) ==0 ) {return check_host_key_hash (s, &host_key_check[4 ],LIBSSH2_HOSTKEY_HASH_MD5 ,16 ); }/* host_key_check=sha1:xx:yy:zz:... */ -if (strlen (host_key_check) >=5 && -strncmp (host_key_check,"sha1:" ,5 ) ==0 ) { +if (strncmp (host_key_check,"sha1:" ,5 ) ==0 ) {return check_host_key_hash (s, &host_key_check[5 ],LIBSSH2_HOSTKEY_HASH_SHA1 ,20 ); }
Signature · 1 line
1.8.1.4
Quoted 5 lines · Richard W.M. Jones
From: "Richard W.M. Jones" <[email protected]>
--- block/ssh.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Reviewed-by Eric Blake <[email protected]>
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Am 18.04.2013 23:09, schrieb Richard W.M. Jones:
Quoted 18 lines
From: "Richard W.M. Jones" <[email protected]>
--- block/ssh.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)block/ssh.c +1
-2@@ -387,15 +387,13 @@ static int check_host_key(BDRVSSHState *s, const char *host, int port, }/* host_key_check=md5:xx:yy:zz:... */ -if (strlen (host_key_check) >=4 && -strncmp (host_key_check,"md5:" ,4 ) ==0 ) { +if (strncmp (host_key_check,"md5:" ,4 ) ==0 ) { return check_host_key_hash(s, &host_key_check[4],
block/ssh.c static int check_host_key(BDRVSSHState *s, const char *host, int port, · line 399
Quoted 10 lines
block/ssh.c +1
-2LIBSSH2_HOSTKEY_HASH_MD5, 16); }/* host_key_check=sha1:xx:yy:zz:... */ -if (strlen (host_key_check) >=5 && -strncmp (host_key_check,"sha1:" ,5 ) ==0 ) { +if (strncmp (host_key_check,"sha1:" ,5 ) ==0 ) {return check_host_key_hash (s, &host_key_check[5 ],LIBSSH2_HOSTKEY_HASH_SHA1 ,20 ); }
Reviewed-by Stefan Weil <[email protected]>
Stefan Hajnoczi
AppliedQuoted 5 lines · Richard W.M. Jones
From: "Richard W.M. Jones" <[email protected]>
--- block/ssh.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches
Stefan