On a Tuesday in 2021, Martin Kletzander wrote:
This eliminates one incorrect parsing implementation which relied on
the
command field not having a closing bracket. This possibility is already
tested against in the virProcessGetStat() tests.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_driver.c | 34 ++++++------------------------
src/util/virprocess.c | 48 ++++++------------------------------------
2 files changed, 13 insertions(+), 69 deletions(-)
[..]
- tokens = g_strsplit(tmp, " ", 0);
- if (!tokens ||
- g_strv_length(tokens) < 20) {
+ if (virStrToLong_ull(proc_stat[21], NULL, 10, timestamp) < 0) {
VIR_PROCESS_STAT_STARTTIME
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Cannot find start time in %s"),
- filename);
+ _("Cannot parse start time %s for pid %d"),
+ proc_stat[21], (int)pid);
return -1;
}
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano