From nobody Tue May 7 06:38:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600832141; cv=none; d=zohomail.com; s=zohoarc; b=WAdMZiiDCo/I0MKFizTZ0chpvQh8trbY7Rf7Shje5/lE+sp/q7UM1GVV11bValba5/cFr5aka8RctvBwDgh+MK+8B4VbYtsZn3EG/q7odVAcfTAMYbASuukBJOty9a2Gy45CwaHsyaMKNynpNYHRcUALus/a6jFLe2saSgi6B+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600832141; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=HPf8DDs+fon2NvLoEbo3mGNtB+SOr+1HWgMyul+DdQM=; b=hosnIHc7lNR5P4kHo9vpUTVG/q2xnCERusIEhJ6j5wrFlm11vEIA28tQN9vu8nlNJlt4f7YDMY20JjuEKcqwSkaYGnURZxpnWynoasspJQkvh+uN1FayBt8BKMUDZHZ/TEqtEVbstERuEOG0psM/BwKNRZZSJCpyz8Mb+4OaVIc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1600832141742108.67784999684784; Tue, 22 Sep 2020 20:35:41 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-440-v9kNmcNuO6msfoKEzIb3MA-1; Tue, 22 Sep 2020 23:35:37 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6532C81CAFC; Wed, 23 Sep 2020 03:35:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23BDA1002382; Wed, 23 Sep 2020 03:35:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AC7351826D2C; Wed, 23 Sep 2020 03:35:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08N3ZMjJ031421 for ; Tue, 22 Sep 2020 23:35:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id D31191004C6F; Wed, 23 Sep 2020 03:35:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCF2910054C7 for ; Wed, 23 Sep 2020 03:35:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5BBC1811E80 for ; Wed, 23 Sep 2020 03:35:19 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-471-Q4SmWHnOPMWDZwumxRTsUA-1; Tue, 22 Sep 2020 23:35:16 -0400 Received: from localhost (unknown [192.168.167.13]) by regular1.263xmail.com (Postfix) with ESMTP id A88C711B4 for ; Wed, 23 Sep 2020 11:35:12 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.70]) by smtp.263.net (postfix) whith ESMTP id P1670T140084936042240S1600832099830906_; Wed, 23 Sep 2020 11:35:12 +0800 (CST) X-MC-Unique: v9kNmcNuO6msfoKEzIb3MA-1 X-MC-Unique: Q4SmWHnOPMWDZwumxRTsUA-1 X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: libvir-list@redhat.com X-SENDER-IP: 14.18.236.70 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Yi Li To: libvir-list@redhat.com Subject: [PATCH] Remove redundant check when storage pool is mounted Date: Wed, 23 Sep 2020 11:34:57 +0800 Message-Id: <20200923033457.3724181-1-yili@winhong.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 08N3ZMjJ031421 X-loop: libvir-list@redhat.com Cc: yilikernel@gmail.com, yili@winhong.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" virFileComparePaths just return 0 or 1 after commit 7b48bb8 so break while after virFileComparePaths return 1 Signed-off-by: Yi Li Reviewed-by: Daniel P. Berrang=C3=A9 --- 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(virStoragePoolObjP= tr pool) FILE *mtab; struct mntent ent; char buf[1024]; - int rc1, rc2; g_autofree char *src =3D NULL; =20 if ((mtab =3D fopen(_PATH_MOUNTED, "r")) =3D=3D NULL) { @@ -262,11 +261,8 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObj= Ptr pool) /* compare both mount destinations and sources to be sure the moun= ted * FS pool is really the one we're looking for */ - if ((rc1 =3D virFileComparePaths(ent.mnt_dir, def->target.path)) <= 0 || - (rc2 =3D 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 =3D 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) --=20 2.25.3