]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
network: convert virFileLinkPointsTo to return bool
authorAnastasia Belova <abelova@astralinux.ru>
Thu, 7 Dec 2023 09:09:38 +0000 (12:09 +0300)
committerMartin Kletzander <mkletzan@redhat.com>
Thu, 7 Dec 2023 10:31:29 +0000 (11:31 +0100)
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 <abelova@astralinux.ru>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/conf/virdomainobjlist.c
src/conf/virnetworkobj.c
src/util/virfile.c
src/util/virfile.h

index 0bd833257da8de8e5ab174859b2c75bc83d85db9..bb5807d00b426ea4fab1b1adf995275f07e444ba 100644 (file)
@@ -497,8 +497,7 @@ virDomainObjListLoadConfig(virDomainObjList *doms,
     if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL)
         return NULL;
 
-    if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
-        return NULL;
+    autostart = virFileLinkPointsTo(autostartLink, configFile);
 
     if (!(dom = virDomainObjListAddLocked(doms, &def, xmlopt, 0, &oldDef)))
         return NULL;
index 20ee8eb58abc0d7c08f767ec754763583ecc0aa0..d5aa121e201d194635f07290ad130112af51ddee 100644 (file)
@@ -945,8 +945,7 @@ virNetworkLoadConfig(virNetworkObjList *nets,
     if ((autostartLink = virNetworkConfigFile(autostartDir, name)) == NULL)
         return NULL;
 
-    if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
-        return NULL;
+    autostart = virFileLinkPointsTo(autostartLink, configFile);
 
     if (!(def = virNetworkDefParse(NULL, configFile, xmlopt, false)))
         return NULL;
index 007b6cf51293234eb9f2da7d02cc1247cdfce855..f3108e99cf6bbd459a5416cda605a3ff93b541ba 100644 (file)
@@ -1697,7 +1697,7 @@ virFileWriteStr(const char *path, const char *str, mode_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)
 {
index 286401e0f58a5a6c3791f0f04d27240cce71279f..56fe309bce68a86f7bc9d8793f3b7ea08ab423fa 100644 (file)
@@ -176,8 +176,8 @@ int virFileReadBufQuiet(const char *file, char *buf, int len)
 int virFileWriteStr(const char *path, const char *str, mode_t mode)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
 
-int virFileLinkPointsTo(const char *checkLink,
-                        const char *checkDest)
+bool virFileLinkPointsTo(const char *checkLink,
+                         const char *checkDest)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 int virFileRelLinkPointsTo(const char *directory,
                            const char *checkLink,