Remove redundant check when storage pool is mounted

virFileComparePaths just return 0 or 1 after commit 7b48bb8
so break while after virFileComparePaths return 1

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Yi Li <yili@winhong.com>
This commit is contained in:
Yi Li 2020-09-23 11:34:57 +08:00 committed by Daniel P. Berrangé
parent cf81c85bf5
commit 0ac453e493
2 changed files with 2 additions and 7 deletions

View File

@ -245,7 +245,6 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
FILE *mtab; FILE *mtab;
struct mntent ent; struct mntent ent;
char buf[1024]; char buf[1024];
int rc1, rc2;
g_autofree char *src = NULL; g_autofree char *src = NULL;
if ((mtab = fopen(_PATH_MOUNTED, "r")) == 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 /* 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
*/ */
if ((rc1 = virFileComparePaths(ent.mnt_dir, def->target.path)) < 0 || if (virFileComparePaths(ent.mnt_dir, def->target.path) &&
(rc2 = virFileComparePaths(ent.mnt_fsname, src)) < 0) virFileComparePaths(ent.mnt_fsname, src)) {
goto cleanup;
if (rc1 && rc2) {
ret = 1; ret = 1;
goto cleanup; goto cleanup;
} }

View File

@ -3884,7 +3884,6 @@ virFileCopyACLs(const char *src,
* Returns: * Returns:
* 1 : Equal * 1 : Equal
* 0 : Non-Equal * 0 : Non-Equal
* -1 : Error
*/ */
int int
virFileComparePaths(const char *p1, const char *p2) virFileComparePaths(const char *p1, const char *p2)