提交 94af82b9 编写于 作者: Y Yi Li 提交者: Ján Tomko

storage: improve the while loop virStorageBackendFileSystemIsMounted

Move virStorageBackendFileSystemGetPoolSource outside of the while loop
Signed-off-by: NYi Li <yili@winhong.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 f62f729b
...@@ -258,10 +258,10 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool) ...@@ -258,10 +258,10 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
goto cleanup; goto cleanup;
} }
while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) != NULL) { if ((src = virStorageBackendFileSystemGetPoolSource(pool)) == NULL)
if (!(src = virStorageBackendFileSystemGetPoolSource(pool))) goto cleanup;
goto cleanup;
while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) != NULL) {
/* compare both mount destinations and sources to be sure the mounted /* compare both mount destinations and sources to be sure the mounted
* FS pool is really the one we're looking for * FS pool is really the one we're looking for
*/ */
...@@ -273,8 +273,6 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool) ...@@ -273,8 +273,6 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
ret = 1; ret = 1;
goto cleanup; goto cleanup;
} }
VIR_FREE(src);
} }
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册