From nobody Mon Feb 9 01:22:44 2026 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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=1639421039; cv=none; d=zohomail.com; s=zohoarc; b=G7OOmcGOFgdmvdZ2Pob06N+gBmgM3a24v50PdYi992AbKQTLJJLC2jP0It/Mtn61dFS2L24It/DZqScOWZtMsq5nvDaSJWdB4zH6bpVvcYoD2mgn+Ua+GUwc6fTxz8466InTljM6OvLoglb37vGf4uj7XctdyT7Bf25iWtTc97k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421039; 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=y0/5yqnN+oZD3yY2UcbTemuqB+zh7v2M5V2onGtJXss=; b=I1RdwlkjrYArDbNBIUVsW7Wdpxu/b4g1rLIoXkgUbn+BOmKitmmiABWRYaD+l4bOyOTa6tcx/VTjCcTJyLxt4ddlqJy3fY/z4bUYIGRiB7LjnfQO885BC/BeZhVxQLRFD6eTm8c/2XMEiy/aU2V0aeQXkT1NseVhOulQlDoRFOY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1639421039515423.2620076663193; Mon, 13 Dec 2021 10:43:59 -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-399-E_VqUCp9MaCNXGihRN0WXw-1; Mon, 13 Dec 2021 13:43:54 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E5A01006ACD; Mon, 13 Dec 2021 18:43:45 +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 0B2ED78C2B; Mon, 13 Dec 2021 18:43:45 +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 CB3594A70B; Mon, 13 Dec 2021 18:43:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhGcS003800 for ; Mon, 13 Dec 2021 13:43:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 014DD60C04; Mon, 13 Dec 2021 18:43:16 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CB4F6107E for ; Mon, 13 Dec 2021 18:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421038; 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=y0/5yqnN+oZD3yY2UcbTemuqB+zh7v2M5V2onGtJXss=; b=XWbk62rNErTp/CLBr7pHN/u1pjOrB7hOO1UfJXWd0iVIeUzSyyIv7pYUypPeb/PRYbBjVa fe1kBk4bFQ62quZpDXLi04pKNsNIXuqiSiz8plJcwQ3OePf3OBWlWT3ZyR4xZ6Mnl57Q+F RMnIcQYMHPc9Y6SyJR94bpDdsWW9zWQ= X-MC-Unique: E_VqUCp9MaCNXGihRN0WXw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/20] openvz: refactor openvzExtractVersionInfo Date: Mon, 13 Dec 2021 19:42:53 +0100 Message-Id: <4557ed7e621049144cc82a643f08bbef4ad83f42.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.12 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: 1639421041142100004 Signed-off-by: J=C3=A1n Tomko --- src/openvz/openvz_conf.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 4fb18c03ee..53170a720b 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -66,11 +66,10 @@ strtoI(const char *str) static int openvzExtractVersionInfo(const char *cmdstr, int *retversion) { - int ret =3D -1; unsigned long version; - char *help =3D NULL; + g_autofree char *help =3D NULL; char *tmp; - virCommand *cmd =3D virCommandNewArgList(cmdstr, "--help", NULL); + g_autoptr(virCommand) cmd =3D virCommandNewArgList(cmdstr, "--help", N= ULL); =20 if (retversion) *retversion =3D 0; @@ -79,27 +78,21 @@ openvzExtractVersionInfo(const char *cmdstr, int *retve= rsion) virCommandSetOutputBuffer(cmd, &help); =20 if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; =20 tmp =3D help; =20 /* expected format: vzctl version .. */ if ((tmp =3D STRSKIP(tmp, "vzctl version ")) =3D=3D NULL) - goto cleanup; + return -1; =20 if (virParseVersionString(tmp, &version, true) < 0) - goto cleanup; + return -1; =20 if (retversion) *retversion =3D version; =20 - ret =3D 0; - - cleanup: - virCommandFree(cmd); - VIR_FREE(help); - - return ret; + return 0; } =20 int openvzExtractVersion(struct openvz_driver *driver) --=20 2.31.1