[PATCH] Remove redundant check when storage pool is mounted

virFileComparePaths just return 0 or 1 after commit 7b48bb8 so break while after virFileComparePaths return 1 Signed-off-by: Yi Li <yili@winhong.com> --- src/storage/storage_backend_fs.c | 8 ++------ src/util/virfile.c | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 536e5cf952..30c2367df4 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -245,7 +245,6 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool) FILE *mtab; struct mntent ent; char buf[1024]; - int rc1, rc2; g_autofree char *src = NULL; if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) { @@ -262,11 +261,8 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool) /* compare both mount destinations and sources to be sure the mounted * FS pool is really the one we're looking for */ - if ((rc1 = virFileComparePaths(ent.mnt_dir, def->target.path)) < 0 || - (rc2 = virFileComparePaths(ent.mnt_fsname, src)) < 0) - goto cleanup; - - if (rc1 && rc2) { + if (virFileComparePaths(ent.mnt_dir, def->target.path) && + virFileComparePaths(ent.mnt_fsname, src)) { ret = 1; goto cleanup; } diff --git a/src/util/virfile.c b/src/util/virfile.c index 61d2c16072..e120d277d0 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3884,7 +3884,6 @@ virFileCopyACLs(const char *src, * Returns: * 1 : Equal * 0 : Non-Equal - * -1 : Error */ int virFileComparePaths(const char *p1, const char *p2) -- 2.25.3

On Wed, Sep 23, 2020 at 11:34:57AM +0800, Yi Li wrote:
virFileComparePaths just return 0 or 1 after commit 7b48bb8 so break while after virFileComparePaths return 1
Signed-off-by: Yi Li <yili@winhong.com> --- src/storage/storage_backend_fs.c | 8 ++------ src/util/virfile.c | 1 - 2 files changed, 2 insertions(+), 7 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> and will push shortly. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrangé
-
Yi Li