]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: Break out the loop if duplicate pool is found
authorOsier Yang <jyang@redhat.com>
Sat, 28 Apr 2012 08:18:44 +0000 (16:18 +0800)
committerCole Robinson <crobinso@redhat.com>
Thu, 7 Jun 2012 22:04:57 +0000 (18:04 -0400)
It doesn't break out the "for" loop even if duplicate pool is
found, and thus the "matchpool" could be overriden as NULL again
if there is different pool afterwards.

To address the problem in libvirt-user list:

https://www.redhat.com/archives/libvirt-users/2012-April/msg00150.html
(cherry picked from commit 980f12be7221b07e569fed24b372ea00c52d9511)

src/conf/storage_conf.c

index 75793277da9c9e0f346d45d818f9512f483b1460..9a42e3496f5b5d95f2d24c16c618aa51980486ac 100644 (file)
@@ -1710,6 +1710,9 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
             break;
         }
         virStoragePoolObjUnlock(pool);
+
+        if (matchpool)
+            break;
     }
 
     if (matchpool) {