[PATCH] report error when virProcessGetStatInfo() is unable to parse data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently virProcessGetStatInfo() always returns success and only logs error
when it is unable to parse the data. Make this function actually report the
error and return a negative value in this error scenario.

Signed-off-by: Ani Sinha <ani@xxxxxxxxxxx>
---
 src/util/virprocess.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index c74bd16fe6..b9f498d5d8 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -1783,7 +1783,11 @@ virProcessGetStatInfo(unsigned long long *cpuTime,
         virStrToLong_ullp(proc_stat[VIR_PROCESS_STAT_STIME], NULL, 10, &systime) < 0 ||
         virStrToLong_l(proc_stat[VIR_PROCESS_STAT_RSS], NULL, 10, &rss) < 0 ||
         virStrToLong_i(proc_stat[VIR_PROCESS_STAT_PROCESSOR], NULL, 10, &cpu) < 0) {
-        VIR_WARN("cannot parse process status data");
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("cannot parse process status data for pid '%d/%d'"),
+                       (int) pid, (int) tid);
+
+        return -1;
     }
 
     /* We got jiffies
-- 
2.25.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux