From nobody Thu Apr 25 23:14:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572690364; cv=none; d=zoho.com; s=zohoarc; b=P9sGkVCLkj6K16HLzqyO8kSgas3wKBb+fSz3oc/hniahNh/fP6L9IygiBpd62+DoiQMeVgQbtGnwX0OJGiCLpC9DXUr4Pz5gdk2hkU6T0+D814Y6551juXTj1rX9oIh/VixbOo29TJv3kjQj5DUH/SBANY4Ku9g3vc7i0lYG/w0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572690364; 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=owInZeZpcJQzPpJyl7qmdDupma2DYdUHw3dQ9pKoClc=; b=WvBIMv1m1fESiyxbutiMwwkelQBSSDzfedqujfPE3Ety3HhueVYjkj4sZ+fDiGX3zGkHRoM/kPuK3SsO+vmTJ0HMrrVGgY1JAzH80g9qjI8EJ0x6vvlpwamPtEfxjJCR5+8sA5VkV1zB6n7ZIYxaTnCSSH0vNqcuCDWgurw5AYA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1572690364512223.81275466875366; Sat, 2 Nov 2019 03:26:04 -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-160-fMh9FYrMP6WFQCAxdLc-WA-1; Sat, 02 Nov 2019 06:26:00 -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 25FCB800EBA; Sat, 2 Nov 2019 10:25:56 +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 0DE7E1001B34; Sat, 2 Nov 2019 10:25:55 +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 D0ABD1809565; Sat, 2 Nov 2019 10:25:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9V3tgn5019051 for ; Wed, 30 Oct 2019 23:55:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 61B8E1001938; Thu, 31 Oct 2019 03:55:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C3D51001B07 for ; Thu, 31 Oct 2019 03:55:40 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.205]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 43EAFC057EC6 for ; Thu, 31 Oct 2019 03:55:38 +0000 (UTC) Received: from localhost (unknown [192.168.167.69]) by regular1.263xmail.com (Postfix) with ESMTP id B0B97342 for ; Thu, 31 Oct 2019 11:55:34 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.69]) by smtp.263.net (postfix) whith ESMTP id P24332T139764275607296S1572494129913735_; Thu, 31 Oct 2019 11:55:34 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572690362; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=owInZeZpcJQzPpJyl7qmdDupma2DYdUHw3dQ9pKoClc=; b=cXvmYch1O8a4z18oiU4YGwptprBcWRF1/l28hp0Qstd/y28fRqPeGBp/Hw2i9EzfhiBhOg 9YtgG0T2Wo7wfTblSdaXMwxvavdvSVviDMubOm9Vrkk5qRa7ifszZW7c6kHVwuDQdhBBZi 9/i07gnDAD2uY6jI7znaDFQ80/N7niU= 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: <547df661db6878d9d2a4c2558860969f> 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.69 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Yi Li To: libvir-list@redhat.com Date: Thu, 31 Oct 2019 11:55:26 +0800 Message-Id: <1572494126-29765-1-git-send-email-yili@winhong.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 31 Oct 2019 03:55:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 31 Oct 2019 03:55:38 +0000 (UTC) for IP:'211.150.70.205' DOMAIN:'regular1.263xmail.com' HELO:'regular1.263xmail.com' FROM:'yili@winhong.com' RCPT:'' X-RedHat-Spam-Score: 0 (RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 211.150.70.205 regular1.263xmail.com 211.150.70.205 regular1.263xmail.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Sat, 02 Nov 2019 06:25:47 -0400 Cc: jtomko@redhat.com, yili@winhong.com Subject: [libvirt] [PATCH] storage: improve the while loop virStorageBackendFileSystemIsMounted 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 X-MC-Unique: fMh9FYrMP6WFQCAxdLc-WA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Move virStorageBackendFileSystemGetPoolSource outside of the while loop Signed-off-by: Yi Li --- 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(virStoragePoolOb= jPtr pool) goto cleanup; } =20 - while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) !=3D NULL) { - if (!(src =3D virStorageBackendFileSystemGetPoolSource(pool))) - goto cleanup; + if ((src =3D virStorageBackendFileSystemGetPoolSource(pool)) =3D=3D NU= LL) + goto cleanup; =20 + while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) !=3D NULL) { /* compare both mount destinations and sources to be sure the moun= ted * FS pool is really the one we're looking for */ --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list