[libvirt] [PATCH 1/2] Fix test wanting a negative size_t

Cédric Bosdonnat cbosdonnat at suse.com
Fri Oct 24 05:15:54 UTC 2014


---
 src/rpc/virnetsshsession.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c
index 7f47b29..57119f9 100644
--- a/src/rpc/virnetsshsession.c
+++ b/src/rpc/virnetsshsession.c
@@ -303,6 +303,7 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess)
     virConnectCredential askKey;
     struct libssh2_knownhost *knownHostEntry = NULL;
     size_t i;
+    bool hasEchoPrompt = false;
     char *hostnameStr = NULL;
 
     if (sess->hostKeyVerify == VIR_NET_SSH_HOSTKEY_VERIFY_IGNORE)
@@ -345,12 +346,12 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess)
 
             for (i = 0; i < sess->cred->ncredtype; i++) {
                 if (sess->cred->credtype[i] == VIR_CRED_ECHOPROMPT) {
-                    i = -1;
+                    hasEchoPrompt = true;
                     break;
                 }
             }
 
-            if (i > 0) {
+            if (!hasEchoPrompt) {
                 virReportError(VIR_ERR_SSH, "%s",
                                _("no suitable method to retrieve "
                                  "authentication credentials"));
-- 
1.8.4.5




More information about the libvir-list mailing list