From nobody Fri Apr 19 09:18:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1641546603191555.9363720765857; Fri, 7 Jan 2022 01:10:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-617-4ZJudBOeOVGkhRw-uN-hQA-1; Fri, 07 Jan 2022 04:10:00 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 327491083F6F; Fri, 7 Jan 2022 09:09:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C2A970D42; Fri, 7 Jan 2022 09:09:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 539F21809CB8; Fri, 7 Jan 2022 09:09:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20799kbY004764 for ; Fri, 7 Jan 2022 04:09:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id D13C053DB; Fri, 7 Jan 2022 09:09:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CBAE453DA for ; Fri, 7 Jan 2022 09:09:43 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9EB1C3810D35 for ; Fri, 7 Jan 2022 09:09:43 +0000 (UTC) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-606-8oThPZGeOeaZxm6N7vA24w-1; Fri, 07 Jan 2022 04:09:42 -0500 Received: by mail-pg1-f172.google.com with SMTP id s1so4968266pga.5 for ; Fri, 07 Jan 2022 01:09:41 -0800 (PST) Received: from anisinha-lenovo.ba.nuagenetworks.net ([203.212.245.248]) by smtp.googlemail.com with ESMTPSA id c10sm1931703pfl.200.2022.01.07.01.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 01:09:40 -0800 (PST) X-MC-Unique: 4ZJudBOeOVGkhRw-uN-hQA-1 X-MC-Unique: 8oThPZGeOeaZxm6N7vA24w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ApKG0FFjRXgyaVgAkcya64nemI/2a6sMye5aQUSy09k=; b=Vd5+ewp3OCJlQXJ7flFxALqiws2vIm4BHpWpJ73hq2TUEAv3JemjnqtD3mqt90DsGx 4gF6qK/BQ/hv6gLhoIK3bc+VBv6zelFhV29Mi0dSHMuFk/pKJPxXDL6F/vPlvvrH2yK3 94DmKSsv/X3Fa18OoJMIxmixJW7h0LptlHTIien/1vQ6NBeXJ/wlBDcizFIpFRyG3cVo hUIe9/tDGszttJQuXae6oZCzjxEAwhGscSfwTnvHJbAwwXTtB0Q9lzGHqtxCduG88cT8 Dcr11IlV1eN3qlVPDPk+EUzONuTyhFws2zC2ul0S0NdfVJivU6ScWKpA2GmiTF8O/+M+ Xcyg== X-Gm-Message-State: AOAM531JDtLnhxBb+TrOj1bhVNvd5T2aBov4Ur8UJAvnVBAavVk51H/I lC/EIPgHKAHPYl8f9pf6OrJuaj2TlbLMUm68 X-Google-Smtp-Source: ABdhPJz8zoCYlaoCHbTCqyoEU7MkxR4xYvlmrMjiSyRlkTBNT+rAQp3xZY+x6Ckl4tN4K8QPFVAT7A== X-Received: by 2002:a63:8c09:: with SMTP id m9mr24654423pgd.138.1641546580597; Fri, 07 Jan 2022 01:09:40 -0800 (PST) From: Ani Sinha To: libvir-list@redhat.com Subject: [PATCH] report error when virProcessGetStatInfo() is unable to parse data Date: Fri, 7 Jan 2022 14:39:26 +0530 Message-Id: <20220107090926.222754-1-ani@anisinha.ca> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Ani Sinha X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1641546604226100001 Content-Type: text/plain; charset="utf-8" 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 --- 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, &sy= stime) < 0 || virStrToLong_l(proc_stat[VIR_PROCESS_STAT_RSS], NULL, 10, &rss) < = 0 || virStrToLong_i(proc_stat[VIR_PROCESS_STAT_PROCESSOR], NULL, 10, &c= pu) < 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; } =20 /* We got jiffies --=20 2.25.1