From nobody Sat May 18 21:16:06 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1701940310153860.5662441735855; Thu, 7 Dec 2023 01:11:50 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id BFA411813; Thu, 7 Dec 2023 04:11:48 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 77A7C17EB; Thu, 7 Dec 2023 04:10:28 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id D415F17DF; Thu, 7 Dec 2023 04:10:22 -0500 (EST) Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BE84317DB for ; Thu, 7 Dec 2023 04:10:20 -0500 (EST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 9FA1C1869E7F; Thu, 7 Dec 2023 12:10:17 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id S2yA7MNtqTfj; Thu, 7 Dec 2023 12:10:17 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 3EED31869E28; Thu, 7 Dec 2023 12:10:17 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id TjdLQKlplTP6; Thu, 7 Dec 2023 12:10:17 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.58]) by mail.astralinux.ru (Postfix) with ESMTPSA id C4DE51869E57; Thu, 7 Dec 2023 12:10:16 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-Virus-Scanned: amavisd-new at astralinux.ru From: Anastasia Belova To: devel@lists.libvirt.org Subject: [PATCH v2] network: convert virFileLinkPointsTo to return bool Date: Thu, 7 Dec 2023 12:09:38 +0300 Message-Id: <20231207090939.31823-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231206183059.16883-1-abelova@astralinux.ru> References: MIME-Version: 1.0 Message-ID-Hash: WX6KWSWCHG2VGZUZQUNUMWJRZD654WBY X-Message-ID-Hash: WX6KWSWCHG2VGZUZQUNUMWJRZD654WBY X-MailFrom: abelova@astralinux.ru X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Anastasia Belova , sdl.qemu@linuxtesting.org X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1701940311654100001 Convert prototype of virFileLinkPointsTo to return bool. Remove dead checks in virDomainObjListLoadConfig and virNetworkLoadConfig. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Anastasia Belova Reviewed-by: Martin Kletzander --- v2: fix logic according to maintainer's answer src/conf/virdomainobjlist.c | 3 +-- src/conf/virnetworkobj.c | 3 +-- src/util/virfile.c | 2 +- src/util/virfile.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index 0bd833257d..bb5807d00b 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -497,8 +497,7 @@ virDomainObjListLoadConfig(virDomainObjList *doms, if ((autostartLink =3D virDomainConfigFile(autostartDir, name)) =3D=3D= NULL) return NULL; =20 - if ((autostart =3D virFileLinkPointsTo(autostartLink, configFile)) < 0) - return NULL; + autostart =3D virFileLinkPointsTo(autostartLink, configFile); =20 if (!(dom =3D virDomainObjListAddLocked(doms, &def, xmlopt, 0, &oldDef= ))) return NULL; diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 20ee8eb58a..d5aa121e20 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -945,8 +945,7 @@ virNetworkLoadConfig(virNetworkObjList *nets, if ((autostartLink =3D virNetworkConfigFile(autostartDir, name)) =3D= =3D NULL) return NULL; =20 - if ((autostart =3D virFileLinkPointsTo(autostartLink, configFile)) < 0) - return NULL; + autostart =3D virFileLinkPointsTo(autostartLink, configFile); =20 if (!(def =3D virNetworkDefParse(NULL, configFile, xmlopt, false))) return NULL; diff --git a/src/util/virfile.c b/src/util/virfile.c index 007b6cf512..f3108e99cf 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1697,7 +1697,7 @@ virFileWriteStr(const char *path, const char *str, mo= de_t mode) /* Return nonzero if checkLink and checkDest * refer to the same file. Otherwise, return 0. */ -int +bool virFileLinkPointsTo(const char *checkLink, const char *checkDest) { diff --git a/src/util/virfile.h b/src/util/virfile.h index 286401e0f5..92400c18fd 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -176,7 +176,7 @@ int virFileReadBufQuiet(const char *file, char *buf, in= t len) int virFileWriteStr(const char *path, const char *str, mode_t mode) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; =20 -int virFileLinkPointsTo(const char *checkLink, +bool virFileLinkPointsTo(const char *checkLink, const char *checkDest) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virFileRelLinkPointsTo(const char *directory, --=20 2.30.2 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org