[libvirt PATCH 10/11] networkBridgeNameValidate: Use virLockGuard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/network/bridge_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index e8b9ffa1fc..5ccc3817d4 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3143,7 +3143,7 @@ static int
 networkBridgeNameValidate(virNetworkObjList *nets,
                           virNetworkDef *def)
 {
-    virMutexLock(&bridgeNameValidateMutex);
+    vir_g_autoptr(virLockGuard) lock = virLockGuardNew(&bridgeNameValidateMutex);
 
     if (def->bridge && !strstr(def->bridge, "%d")) {
         if (virNetworkObjBridgeInUse(nets, def->bridge, def->name)) {
@@ -3158,11 +3158,9 @@ networkBridgeNameValidate(virNetworkObjList *nets,
             goto error;
     }
 
-    virMutexUnlock(&bridgeNameValidateMutex);
     return 0;
 
  error:
-    virMutexUnlock(&bridgeNameValidateMutex);
     return -1;
 }
 
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux