]> 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)
committerOsier Yang <jyang@redhat.com>
Mon, 30 Apr 2012 13:12:58 +0000 (21:12 +0800)
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

src/conf/storage_conf.c

index 6475181c5587d21f6da44eb4f14af6ddcdb4c9bd..3b7879f25bc4db1e1191ca3a40137ccb29f168bb 100644 (file)
@@ -1736,6 +1736,9 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
             break;
         }
         virStoragePoolObjUnlock(pool);
+
+        if (matchpool)
+            break;
     }
 
     if (matchpool) {