From nobody Sun Apr 28 14:10:31 2024 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=1622812369; cv=none; d=zohomail.com; s=zohoarc; b=TWYP0Tp/VNQLNF4ATk7HMizEVR3b3rSSGH5atrqnv/1cC8ydoqEITk37eRvT6BvXh2GUL3Wf01fpB9QGSWdzhWP17+dBFmR+7TLW2g04B+oU3rjH7nnpzEDttGRUXcqRASb2qvH5UW14RCk9NHyEbUGvnnnUDs0t9dau1BoEavA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622812369; 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=NHoActFcn/pZO6MrB29pGGSeHcbY3c+aaEEwhA+jrFY=; b=Bpa7RZsKgcMU0dKVxsRiBaqS9/yij7jlBo3zFvJ1xFcmEnMMLHncys8iWIVpHZ644l27rzDq9HDp1YG6xBEA2lspc+E7X0oEfEwdyJHaAhL4JPJUrut4I2jjM/bSUqvCKRKRr794Z5bQLtDuHDngG+3/HYIgMck3GvM17Vn1V6Y= 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) header.from= 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 1622812369423218.66544307821835; Fri, 4 Jun 2021 06:12:49 -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-280-o4A53DxPNJGITIj9w0ApPQ-1; Fri, 04 Jun 2021 09:12:46 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB4E3107ACE4; Fri, 4 Jun 2021 13:12:41 +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 9AFEA1B49E; Fri, 4 Jun 2021 13:12:41 +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 61E5F180B651; Fri, 4 Jun 2021 13:12:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 154DApPK026520 for ; Fri, 4 Jun 2021 09:10:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4DF655C26D; Fri, 4 Jun 2021 13:10:51 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6DBD5C1C5 for ; Fri, 4 Jun 2021 13:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622812368; 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=NHoActFcn/pZO6MrB29pGGSeHcbY3c+aaEEwhA+jrFY=; b=Kj2BNus5yBHagFTYBQnfEFGkfpoR0wtnC3HEcFRrIj5U81CpgTxzTOuKigAzOqhUD9/Xzl ITnuoeqM3tBkDEygQ9UQEW2+oYGpEoOWMPg7auTMi0Tx25Wg/tHEYOb3qsAAPYytC6/XEh KEvkps2735aq6kPlgN4JGkFrc86/3lc= X-MC-Unique: o4A53DxPNJGITIj9w0ApPQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/6] ch_conf: Move error reporting into chExtractVersionInfo() Date: Fri, 4 Jun 2021 15:10:40 +0200 Message-Id: <78d85cf71aad1694e583c927fdec5ad6130055c7.1622812176.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.13 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If chExtractVersionInfo() fails, in some cases it reports error and in some it doesn't. Fix those places and drop reporting error from chExtractVersion() which would just overwrite more specific error. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/ch/ch_conf.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c index 2dd104b8a8..d900ebc7dd 100644 --- a/src/ch/ch_conf.c +++ b/src/ch/ch_conf.c @@ -213,11 +213,17 @@ chExtractVersionInfo(int *retversion) tmp =3D help; =20 /* expected format: cloud-hypervisor v.. */ - if ((tmp =3D STRSKIP(tmp, "cloud-hypervisor v")) =3D=3D NULL) + if ((tmp =3D STRSKIP(tmp, "cloud-hypervisor v")) =3D=3D NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unexpected output of cloud-hypervisor binary")); goto cleanup; + } =20 - if (virParseVersionString(tmp, &version, true) < 0) + if (virParseVersionString(tmp, &version, true) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to parse cloud-hypervisor version: %s"), = tmp); goto cleanup; + } =20 if (version < MIN_VERSION) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -241,11 +247,8 @@ int chExtractVersion(virCHDriver *driver) if (driver->version > 0) return 0; =20 - if (chExtractVersionInfo(&driver->version) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not extract Cloud-Hypervisor version")); + if (chExtractVersionInfo(&driver->version) < 0) return -1; - } =20 return 0; } --=20 2.31.1 From nobody Sun Apr 28 14:10:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1622812273; cv=none; d=zohomail.com; s=zohoarc; b=P80DKAvL+tCrp+vUhe1b1Miearx2OtdFKjY7krDfk0sOM+LNtLUlh3Zx5aNDTCAkSvs9bCCpSfFibP5rbwOJCpDlfHm8C/NSEQcLePeHSJQUlNvkExcYYtvcV0bkqKNOk79JBgigrNSuP2iOd6ISxaF3HPpRBVkZo1biaHU5ddc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622812273; 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=VaN1I0Bm2t5RF02SUyNGUvNOqy90Hoszj+58J3W6d7g=; b=GZC8Isji8kpM3fI6mhN8NY5ZbcTeLQeAlkwiC1Vk6h4TJjr/cR3lwobwHjGmBc6xJkgn2OsERziIEplBwMFPNL/vlccEE2eQ9GfbPpBXxXb7LnIGtxMLTneVcbX3EsaZuc6qkOJrKVZdVj2khYPmQqK0+QJH2hVgcPlswW6D4uE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1622812273804644.4235345709553; Fri, 4 Jun 2021 06:11:13 -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-465-c-bmqGbHOpm0kgr3E4vYEQ-1; Fri, 04 Jun 2021 09:11:10 -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 5210610074A7; Fri, 4 Jun 2021 13:11:04 +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 C6DDF39A66; Fri, 4 Jun 2021 13:11:03 +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 BC72344A58; Fri, 4 Jun 2021 13:11:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 154DAqPr026526 for ; Fri, 4 Jun 2021 09:10:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2605A5C26D; Fri, 4 Jun 2021 13:10:52 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E2635C1C5 for ; Fri, 4 Jun 2021 13:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622812272; 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=VaN1I0Bm2t5RF02SUyNGUvNOqy90Hoszj+58J3W6d7g=; b=f5sZ/m62gWhbiv8avb312vnNmPbqBmPd0xpRafytFEr/TBfd76+cW6GdSnjY7YCfrtmYfw RVyr3Cow5+8MorZqzU00G0DHlxzh5m20yKjeq9Q0T6+2Kf+5UW4amMVvgAkw+O4Dk6+QPF enoOEEx8RVVixrxGzg6p1/lBn6sXfGk= X-MC-Unique: c-bmqGbHOpm0kgr3E4vYEQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/6] chExtractVersionInfo: Don't check for retversion != NULL Date: Fri, 4 Jun 2021 15:10:41 +0200 Message-Id: <5d3b6deaafba09c607afb1705b61d895b3e694ab.1622812176.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The only caller, chExtractVersion() passes not NULL. Therefore, it's redundant to check for NULL. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/ch/ch_conf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c index d900ebc7dd..706e5f0ba4 100644 --- a/src/ch/ch_conf.c +++ b/src/ch/ch_conf.c @@ -201,8 +201,7 @@ chExtractVersionInfo(int *retversion) g_autofree char *ch_cmd =3D g_find_program_in_path(CH_CMD); virCommand *cmd =3D virCommandNewArgList(ch_cmd, "--version", NULL); =20 - if (retversion) - *retversion =3D 0; + *retversion =3D 0; =20 virCommandAddEnvString(cmd, "LC_ALL=3DC"); virCommandSetOutputBuffer(cmd, &help); @@ -231,9 +230,7 @@ chExtractVersionInfo(int *retversion) goto cleanup; } =20 - if (retversion) - *retversion =3D version; - + *retversion =3D version; ret =3D 0; =20 cleanup: --=20 2.31.1 From nobody Sun Apr 28 14:10:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1622812373; cv=none; d=zohomail.com; s=zohoarc; b=T8M+2xXPHGI7SxEcHtzOVywH1+yOSj1uf6HzJerRgfXmr7UOlMDrkwPRlLpcDClTJtonGnkj6ihKayfJnPMzNyQg/+fxZeoSYPoskqnDsoDZBfWwtRpqffs9+upCTB2XrAP00lmh8TUuKB4+StZnIgIfflJkZqHOZ6BCY9ZHWYc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622812373; 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=y5WbYd5cWqwcnki+UGcT01pMXgDi/7uzRkk0zhuiM+s=; b=UNotXtr9c8WhLyBbu/MDfmiXx7T4nxHpSBSjP9P4a6L3XK4BGSkiyOqrQO9azQUCcn9IYNfoqbtgoIhmL+AGeYdB6ZNxN1MR3jY1oysiriz9Z3J4lGvIB2dkGhzYKJ9/q2beMCTDqKpQJf+yCyVJQNdoCDKYmtUjKvbwBS8RFYM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1622812373798703.402420210086; Fri, 4 Jun 2021 06:12:53 -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-369-5JOOrDwvOA6UAQnJLzCdKA-1; Fri, 04 Jun 2021 09:12:50 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C2ABE10082E0; Fri, 4 Jun 2021 13:12:44 +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 9B32119C79; Fri, 4 Jun 2021 13:12:44 +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 5F76644A59; Fri, 4 Jun 2021 13:12:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 154DAq00026540 for ; Fri, 4 Jun 2021 09:10:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id F10245C26D; Fri, 4 Jun 2021 13:10:52 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 758FB5C1C5 for ; Fri, 4 Jun 2021 13:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622812372; 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=y5WbYd5cWqwcnki+UGcT01pMXgDi/7uzRkk0zhuiM+s=; b=Du5qDFGDF7iIWdKly5yS5ms1Apoqlv3s7Ajv50u0YcZ83+OuhIcfW1YIKk4z1wQJAKiGcO BXci0iC6p/5JIpFpE3ckWIweXoStEXti32RWiweeiCIIR2/UfUCg0jReIlTr4ManIC6Vop Srm76T/OH1UeEhkYXzbKZxs2+mCdTdY= X-MC-Unique: 5JOOrDwvOA6UAQnJLzCdKA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/6] ch_conf: Dissolve chExtractVersionInfo() in chExtractVersion() Date: Fri, 4 Jun 2021 15:10:42 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.84 on 10.5.11.23 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" After previous patches, there's not much value in chExtractVersion(). Rename chExtractVersionInfo() to chExtractVersion() and have it use virCHDriver directly. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/ch/ch_conf.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c index 706e5f0ba4..dfebc8525a 100644 --- a/src/ch/ch_conf.c +++ b/src/ch/ch_conf.c @@ -191,8 +191,8 @@ virCHDriverConfigDispose(void *obj) =20 #define MIN_VERSION ((15 * 1000000) + (0 * 1000) + (0)) =20 -static int -chExtractVersionInfo(int *retversion) +int +chExtractVersion(virCHDriver *driver) { int ret =3D -1; unsigned long version; @@ -201,8 +201,6 @@ chExtractVersionInfo(int *retversion) g_autofree char *ch_cmd =3D g_find_program_in_path(CH_CMD); virCommand *cmd =3D virCommandNewArgList(ch_cmd, "--version", NULL); =20 - *retversion =3D 0; - virCommandAddEnvString(cmd, "LC_ALL=3DC"); virCommandSetOutputBuffer(cmd, &help); =20 @@ -230,22 +228,10 @@ chExtractVersionInfo(int *retversion) goto cleanup; } =20 - *retversion =3D version; + driver->version =3D version; ret =3D 0; =20 cleanup: virCommandFree(cmd); - return ret; } - -int chExtractVersion(virCHDriver *driver) -{ - if (driver->version > 0) - return 0; - - if (chExtractVersionInfo(&driver->version) < 0) - return -1; - - return 0; -} --=20 2.31.1 From nobody Sun Apr 28 14:10:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1622812351; cv=none; d=zohomail.com; s=zohoarc; b=Cn62inzKIoGp9A+p0MkiyuX0A6+iwueeoT9Xj0hEGwqYRNA4n1NdhXcyQSYpUwglqk7wVY70fReYfwUZeR/0wN7z1xz5AeyN0n6LZyixJvdXLY61nitttVzhLSTweQnhm0p+jgCpe0jUcY4kkg8gwW7my7rL51HoOVodFYmuqrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622812351; 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=GyhhHwtmn3xwD53Xcib61wIcPgKqoecDBW77IG59NoE=; b=Hct4yDKDLCXwbmswbSUjIc+q9lFKkrPGMEvEwBV3v1+EZlAPyZLg+w0YkTYzrhkrBpAWD+C14P0tVk9/ouboopo2hMg/w97dD2UlnlR2uOy7IrXyqtuDk2JOMDQsRAj0Xfh2XYIRw+XR9IuEHe9uSuiWHCJuzhFASpOVSdQ70UA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1622812351615668.0661176453937; Fri, 4 Jun 2021 06:12:31 -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-189-OOFit8vDNXqnKbI6UauBDg-1; Fri, 04 Jun 2021 09:12:27 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C94E501E5; Fri, 4 Jun 2021 13:12:21 +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 65A1E10023AB; Fri, 4 Jun 2021 13:12:21 +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 1F8EC1801266; Fri, 4 Jun 2021 13:12:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 154DArAB026546 for ; Fri, 4 Jun 2021 09:10:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8A4B5C26D; Fri, 4 Jun 2021 13:10:53 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CC645C1C5 for ; Fri, 4 Jun 2021 13:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622812350; 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=GyhhHwtmn3xwD53Xcib61wIcPgKqoecDBW77IG59NoE=; b=CQV2ywAMOjaDILbp1DitBfD5Ex4HXvTRT4BMvr5D0vPCxl6e4lMJXrdr+MnZesTl3leIMA vrCNPHmFHuT1rbdEut3oDzSB9S267MkJJerNDT8gfy1ug//HEoocbcI+ysjnm8Tp7Hmsxg xaFoTgn1WFhK5R9tNEq2XirQ6arPmmw= X-MC-Unique: OOFit8vDNXqnKbI6UauBDg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/6] ch_driver: Don't error out if CH_CMD was not found Date: Fri, 4 Jun 2021 15:10:43 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.84 on 10.5.11.22 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The CH driver needs "cloud-hypervisor" binary. And if none was found then the initialization of the driver fails as chStateInitialize() returns VIR_DRV_STATE_INIT_ERROR. This in turn means that whole daemon fails to initialize. Let's return VIR_DRV_STATE_INIT_SKIPPED in this particular case, which disables the CH drvier but lets the daemon run. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/ch/ch_conf.c | 6 +++++- src/ch/ch_driver.c | 15 +++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c index dfebc8525a..b2812de7ad 100644 --- a/src/ch/ch_conf.c +++ b/src/ch/ch_conf.c @@ -199,8 +199,12 @@ chExtractVersion(virCHDriver *driver) char *help =3D NULL; char *tmp =3D NULL; g_autofree char *ch_cmd =3D g_find_program_in_path(CH_CMD); - virCommand *cmd =3D virCommandNewArgList(ch_cmd, "--version", NULL); + virCommand *cmd =3D NULL; =20 + if (!ch_cmd) + return -2; + + cmd =3D virCommandNewArgList(ch_cmd, "--version", NULL); virCommandAddEnvString(cmd, "LC_ALL=3DC"); virCommandSetOutputBuffer(cmd, &help); =20 diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 7d1e97098a..8c458a20bd 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -836,6 +836,9 @@ static int chStateInitialize(bool privileged, virStateInhibitCallback callback G_GNUC_UNUSE= D, void *opaque G_GNUC_UNUSED) { + int ret =3D VIR_DRV_STATE_INIT_ERROR; + int rv; + if (root !=3D NULL) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Driver does not support embedded mode")); @@ -861,14 +864,18 @@ static int chStateInitialize(bool privileged, if (!(ch_driver->config =3D virCHDriverConfigNew(privileged))) goto cleanup; =20 - if (chExtractVersion(ch_driver) < 0) + if ((rv =3D chExtractVersion(ch_driver)) < 0) { + if (rv =3D=3D -2) + ret =3D VIR_DRV_STATE_INIT_SKIPPED; goto cleanup; + } =20 - return VIR_DRV_STATE_INIT_COMPLETE; + ret =3D VIR_DRV_STATE_INIT_COMPLETE; =20 cleanup: - chStateCleanup(); - return VIR_DRV_STATE_INIT_ERROR; + if (ret !=3D VIR_DRV_STATE_INIT_COMPLETE) + chStateCleanup(); + return ret; } =20 /* Function Tables */ --=20 2.31.1 From nobody Sun Apr 28 14:10:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1622812353; cv=none; d=zohomail.com; s=zohoarc; b=boeinEoRzaofhUbqLGeg8yCohg5HsdOB50RX9DFjErt1x5Ul8Az/cTN/kDjd0ckxiIA2dC96MKOq610vzepalD5ljkOhABGKf+uhgM1dvPqypRK2h7IkbLgMN3Rrr50RSAinqLqlZ/bjWhK1+k/mAcOSq1YSp9LCEIstDjybCXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622812353; 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=FedIxccGXBCZurYXavkQmzEpluvv6LoPzJYH4In5/sQ=; b=VU82vE5tAfDmIEhNYH+MxT8KH8AzbmeH9oB+bjaJsOTGfNBj7OkjotJRqPzd+4G1K5dPphN6+UcyT4UCCN29T8Dk2+BIzA4H7PKGJ5Bmy9Icxz1EbM8wP92ZTEBTSzdQR43B7JNuOQvu8BGP0NY1lA/onEkSMlr7Py8gvhu7sIk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1622812353920961.6824797720448; Fri, 4 Jun 2021 06:12:33 -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-187-2hhJvvJZPlqr9CwYZuJoTg-1; Fri, 04 Jun 2021 09:12:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9E188501E0; Fri, 4 Jun 2021 13:12:24 +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 717D010023AB; Fri, 4 Jun 2021 13:12:24 +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 3AF464ED79; Fri, 4 Jun 2021 13:12:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 154DAsXW026551 for ; Fri, 4 Jun 2021 09:10:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9F8875C26D; Fri, 4 Jun 2021 13:10:54 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 242065C1C5 for ; Fri, 4 Jun 2021 13:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622812352; 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=FedIxccGXBCZurYXavkQmzEpluvv6LoPzJYH4In5/sQ=; b=iQsVJrZYhTbTG526WwshbQaEDLmDxdaIvWiBHb42ZkjOmlY+tKcMNx8qUn1d9rULFwLxcd oMYb0uJXY5whDqgsKOysdWfsFtMY3g/Ay1dV+h7kwsJC/bxSJPKKOivpEuk65e5vKeGFpe x5YK8jCr+i5XB3ox2jglBvOo04Cmpwo= X-MC-Unique: 2hhJvvJZPlqr9CwYZuJoTg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/6] chExtractVersion: use g_auto* Date: Fri, 4 Jun 2021 15:10:44 +0200 Message-Id: <477b5135b01526bfebe6802caf1898c2902f2e63.1622812176.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.84 on 10.5.11.22 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" There are two variables that can be freed automatically: @cmd (which allows us to drop explicit virCommandFree() call at the end of the function) and @help which was never freed (and thus leaked). Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/ch/ch_conf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c index b2812de7ad..c67c815d45 100644 --- a/src/ch/ch_conf.c +++ b/src/ch/ch_conf.c @@ -196,10 +196,10 @@ chExtractVersion(virCHDriver *driver) { int ret =3D -1; unsigned long version; - char *help =3D NULL; + g_autofree char *help =3D NULL; char *tmp =3D NULL; g_autofree char *ch_cmd =3D g_find_program_in_path(CH_CMD); - virCommand *cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; =20 if (!ch_cmd) return -2; @@ -236,6 +236,5 @@ chExtractVersion(virCHDriver *driver) ret =3D 0; =20 cleanup: - virCommandFree(cmd); return ret; } --=20 2.31.1 From nobody Sun Apr 28 14:10:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1622812283; cv=none; d=zohomail.com; s=zohoarc; b=MOoDonT5T+OOv2gSXqFn3qHXSb572mp4zYVeSGcPdszMXOE80kvMFBIdNzbrnHt++meF/dKInqiTnSln/jBn7eaplqX+SNqZyqcrfM65JPpA2+jr3+8gvceBeFJgdFOivJaCUDbEaeqeyRKG5lxTnzcUxIR0GYbAwn5qYe5/U5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622812283; 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=LgYueKHMsxCxGwDFBK8+jiN+9OIQBF1nfsKqlTeFARk=; b=lHJNqQaYYGxdteNhW2BBVIThGrzb8UdTgktnJNBbd3oN50rwX5qH9XI0nzW101sYudTl+2mSTe9H1PC5K0ipevsIJP+1rZYetYnxwIMQVzSZofYG01lWTmW5ODTNs8zckSkJaNQviLltgVJ18NHsfCxSeiH154xTI3QJneo05Do= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1622812283837151.64910605829255; Fri, 4 Jun 2021 06:11:23 -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-331-geIjn3CMM_ikO2I9j_bUvw-1; Fri, 04 Jun 2021 09:11:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3DB77801817; Fri, 4 Jun 2021 13:11:13 +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 1A0EE60622; Fri, 4 Jun 2021 13:11:13 +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 878761800BB8; Fri, 4 Jun 2021 13:11:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 154DAt4f026569 for ; Fri, 4 Jun 2021 09:10:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 770695C26D; Fri, 4 Jun 2021 13:10:55 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFB895C1C5 for ; Fri, 4 Jun 2021 13:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622812282; 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=LgYueKHMsxCxGwDFBK8+jiN+9OIQBF1nfsKqlTeFARk=; b=O7QCsvyJ3ul4BZzFMhe6tbmksJnF1XHHKCVEI5QwvkVXX2uXSVFRcmO7mYzkYw95l911O1 WlpUqo9tYXDyIoSY+bqCs3mmbLBmmRjQlYIHm8vapiAiZVBc6a8vzf3BPiGJf4ds1iarj7 3852LuNgjm0VDZE/0oG+sYWEHkTgekY= X-MC-Unique: geIjn3CMM_ikO2I9j_bUvw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 6/6] chExtractVersion: Drop @ret Date: Fri, 4 Jun 2021 15:10:45 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.13 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" After previous patches, the @ret variable and the 'cleanup' label are redundant. Remove them. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/ch/ch_conf.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c index c67c815d45..5f156dfe44 100644 --- a/src/ch/ch_conf.c +++ b/src/ch/ch_conf.c @@ -194,7 +194,6 @@ virCHDriverConfigDispose(void *obj) int chExtractVersion(virCHDriver *driver) { - int ret =3D -1; unsigned long version; g_autofree char *help =3D NULL; char *tmp =3D NULL; @@ -209,7 +208,7 @@ chExtractVersion(virCHDriver *driver) virCommandSetOutputBuffer(cmd, &help); =20 if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; =20 tmp =3D help; =20 @@ -217,24 +216,21 @@ chExtractVersion(virCHDriver *driver) if ((tmp =3D STRSKIP(tmp, "cloud-hypervisor v")) =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unexpected output of cloud-hypervisor binary")); - goto cleanup; + return -1; } =20 if (virParseVersionString(tmp, &version, true) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unable to parse cloud-hypervisor version: %s"), = tmp); - goto cleanup; + return -1; } =20 if (version < MIN_VERSION) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cloud-Hypervisor version is too old (v15.0 is th= e minimum supported version)")); - goto cleanup; + return -1; } =20 driver->version =3D version; - ret =3D 0; - - cleanup: - return ret; + return 0; } --=20 2.31.1