[Spice-commits] SpiceXPI/src

Hans de Goede jwrdegoede at kemper.freedesktop.org
Tue Jun 7 04:27:35 PDT 2011


 SpiceXPI/src/plugin/controller.cpp |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 14850c88258d2567bcad857fff7410274f8e0e5c
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Tue Jun 7 13:26:20 2011 +0200

    Fix SpiceController::Connect sometimes returning success without connecting
    
    SpiceController::Connect (the retry wrapper version) was using rc
    uninitialized, and if rc happened to be 0 it would return success without
    actually connecting.
    
    Also zap the check for a negative retry count if someone is stupid enough
    to do that we will never enter the loop and return the initial
    (now initialized to -1) rc value.

diff --git a/SpiceXPI/src/plugin/controller.cpp b/SpiceXPI/src/plugin/controller.cpp
index a3edccb..2c1d9f4 100644
--- a/SpiceXPI/src/plugin/controller.cpp
+++ b/SpiceXPI/src/plugin/controller.cpp
@@ -121,11 +121,7 @@ int SpiceController::Connect()
 
 int SpiceController::Connect(const int nRetries)
 {
-    // arent we foolish?
-    if (nRetries < 0)
-        return -1;
-
-    int rc;
+    int rc = -1;
     int sleep_time = 0;
 
     // try to connect for specified count


More information about the Spice-commits mailing list