[PATCH] storage: improve the while loop virStorageBackendFileSystemIsMounted

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

 



Move virStorageBackendFileSystemGetPoolSource outside of the while loop

Signed-off-by: Yi Li <yili@xxxxxxxxxxx>
---
 src/storage/storage_backend_fs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 02b8248..10d9457 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -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
          */
-- 
2.7.5



--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[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