[libvirt] [PATCH 08/20] test: testConnectAuthenticate: Take the lock when accessing mutable values

Marc Hartmayer mhartmay at linux.vnet.ibm.com
Thu Mar 8 12:20:31 UTC 2018


Signed-off-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
---
 src/test/test_driver.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 388407d4371f..b0ce7d0eea0a 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1379,8 +1379,11 @@ testConnectAuthenticate(virConnectPtr conn,
     ssize_t i;
     char *username = NULL, *password = NULL;
 
-    if (privconn->numAuths == 0)
+    testDriverLock(privconn);
+    if (privconn->numAuths == 0) {
+        testDriverUnlock(privconn);
         return 0;
+    }
 
     /* Authentication is required because the test XML contains a
      * non-empty <auth/> section.  First we must ask for a username.
@@ -1420,6 +1423,7 @@ testConnectAuthenticate(virConnectPtr conn,
 
     ret = 0;
  cleanup:
+    testDriverUnlock(privconn);
     VIR_FREE(username);
     VIR_FREE(password);
     return ret;
-- 
2.13.4




More information about the libvir-list mailing list