mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: improve the while loop virStorageBackendFileSystemIsMounted
Move virStorageBackendFileSystemGetPoolSource outside of the while loop Signed-off-by: Yi Li <yili@winhong.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f62f729b42
commit
94af82b936
@ -258,10 +258,10 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) != NULL) {
|
||||
if (!(src = virStorageBackendFileSystemGetPoolSource(pool)))
|
||||
goto cleanup;
|
||||
if ((src = virStorageBackendFileSystemGetPoolSource(pool)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) != NULL) {
|
||||
/* compare both mount destinations and sources to be sure the mounted
|
||||
* FS pool is really the one we're looking for
|
||||
*/
|
||||
@ -273,8 +273,6 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
|
||||
ret = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
VIR_FREE(src);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user