From nobody Sun Feb 8 10:49:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1628009278; cv=none; d=zohomail.com; s=zohoarc; b=E9FR4NKK5bisiEutzBpypwARTaf27bxn8KkcqqLFyJPoB77UUJKcYCUin9QJG1FBQjK7bF6bAlCk5i+Br3XQ/E1Np7PN9Xe1/8csOk34u8AGtAhub/lvJgS+xkEeIyzVsvFCPVGDhC52H+a4QqRXkXe3GpjZP3kbYDLRKBklWFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628009278; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I3sNYXDveSPQKEGjJwMEckakQNuzYunrGiwkcKGpC9M=; b=VjyK2H2CXsRKhNTwkswDJHjl1udB7v6poj+8MhZEwbVw8o6IdH5QTtmkdu2GZHwWrjp8r2EwcG/wlgIZ/dYqwT745pTTBSxicKBpP7ISA+PvpJ8gb2kTDCzntxvau/9fw9h93X7/D1YmgjL9AdwPRyI9a2sB5RUGXqrDQmAWUy8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 162800927884179.90472021330675; Tue, 3 Aug 2021 09:47:58 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-65-XPgNP7y1Mo2r2fnEQqP-5w-1; Tue, 03 Aug 2021 12:47:37 -0400 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 4A85393937; Tue, 3 Aug 2021 16:47:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F17A136F5; Tue, 3 Aug 2021 16:47:28 +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 ED79450046; Tue, 3 Aug 2021 16:47:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 173FDrhF011120 for ; Tue, 3 Aug 2021 11:13:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0F6521F5; Tue, 3 Aug 2021 15:13:53 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E4D319C44 for ; Tue, 3 Aug 2021 15:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628009277; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=I3sNYXDveSPQKEGjJwMEckakQNuzYunrGiwkcKGpC9M=; b=ZWJc8fkYl0v21EXPSOww3qKlthYPkKxWZ1ciVZ8IYC5LXQRxt7G8CZNFdJMFez3yVQOt9r 2oj9qxxgdVZA/JN7HPIuFwydQPwn9q+OwT8+ITX7loExPxqWaTVpu32kB7zC5ZBJVLRuZU u/jHzeb1MqMDLSgl3laxRpHOv/r5ovY= X-MC-Unique: XPgNP7y1Mo2r2fnEQqP-5w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/6] virProcessKillPainfullyDelay: use 'rc' variable Date: Tue, 3 Aug 2021 17:13:40 +0200 Message-Id: <875d3c19c9d9013354c46ffd7be88d8648703ee4.1628003420.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628009280910100001 Use 'rc' to store the return value of virProcessKill, to separate the value check from the function call. Signed-off-by: J=C3=A1n Tomko --- 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 67dd599b3e..d58e983b56 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -395,6 +395,8 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, uns= igned int extradelay) */ for (i =3D 0; i < polldelay; i++) { int signum; + int rc; + if (i =3D=3D 0) { signum =3D SIGTERM; /* kindly suggest it should exit */ } else if (i =3D=3D 50 && force) { @@ -413,7 +415,9 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, uns= igned int extradelay) signum =3D 0; /* Just check for existence */ } =20 - if (virProcessKill(pid, signum) < 0) { + rc =3D virProcessKill(pid, signum); + + if (rc < 0) { if (errno !=3D ESRCH) { virReportSystemError(errno, _("Failed to terminate process %lld w= ith SIG%s"), --=20 2.31.1