]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
src: Don't use virReportSystemError() on virProcessGetStatInfo() failure
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 18 Jan 2023 08:03:29 +0000 (09:03 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 23 Jan 2023 15:16:03 +0000 (16:16 +0100)
Firstly, the virProcessGetStatInfo() does not fail really. But
even if it did, it sets correct errno only sometimes (and even
that is done in a helper it's calling - virProcessGetStat() and
even there it's the case only in very few error paths).

Therefore, using virReportSystemError() to report errors is very
misleading. Use plain virReportError() instead. Luckily, there
are only two places where the former was used:
chDomainHelperGetVcpus() and qemuDomainHelperGetVcpus() (not a
big surprise since CH driver is heavily inspired by QEMU driver).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/ch/ch_driver.c
src/qemu/qemu_driver.c

index db2a66d13112555c5190a5f87d85a961d66b8597..12fbe31c2498b934e3522c5075127dc0a0fbaa0f 100644 (file)
@@ -1079,8 +1079,8 @@ chDomainHelperGetVcpus(virDomainObj *vm,
                                       NULL, NULL,
                                       &vcpuinfo->cpu, NULL,
                                       vm->pid, vcpupid) < 0) {
-                virReportSystemError(errno, "%s",
-                                      _("cannot get vCPU placement & pCPU time"));
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                               _("cannot get vCPU placement & pCPU time"));
                 return -1;
             }
         }
index d6879175fece63aadc813380d10d2af91e9bc60c..c576c601adb706a2e0183909286475bef7527a18 100644 (file)
@@ -1355,8 +1355,8 @@ qemuDomainHelperGetVcpus(virDomainObj *vm,
                                       NULL, NULL,
                                       &vcpuinfo->cpu, NULL,
                                       vm->pid, vcpupid) < 0) {
-                virReportSystemError(errno, "%s",
-                                     _("cannot get vCPU placement & pCPU time"));
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                               _("cannot get vCPU placement & pCPU time"));
                 return -1;
             }
         }