[PATCH v3 2/2] Use virProcessGetStat

Ján Tomko jtomko at redhat.com
Tue Nov 23 15:27:19 UTC 2021


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 at 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 at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20211123/5bb52076/attachment-0001.sig>


More information about the libvir-list mailing list