From nobody Mon Apr 29 03:52:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1506427533223590.5086693002047; Tue, 26 Sep 2017 05:05:33 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 9E9CC81DFD; Tue, 26 Sep 2017 12:05:31 +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 735A069573; Tue, 26 Sep 2017 12:05:31 +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 38C16410B4; Tue, 26 Sep 2017 12:05:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8QBecnV029641 for ; Tue, 26 Sep 2017 07:40:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 65C134388; Tue, 26 Sep 2017 11:40:38 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E07EF6F106 for ; Tue, 26 Sep 2017 11:40:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9E9CC81DFD Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 26 Sep 2017 13:40:30 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] conf: fix formatting of udp chardev attributes 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 26 Sep 2017 12:05:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It is possible (although possibly not very useful) to leave out the service attribute when using Fix the formatter bug introduced by commit 4a0da34 and format the host when its present (checked for non-NULL inside virBufferEscapeString) instead of basing it on the presence of the service attribute. https://bugzilla.redhat.com/show_bug.cgi?id=3D1455825 --- src/conf/domain_conf.c | 12 ++++-------- tests/genericxml2xmloutdata/generic-chardev-udp.xml | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 44cfb52b4..3c3db7291 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23307,19 +23307,15 @@ virDomainChrSourceDefFormat(virBufferPtr buf, case VIR_DOMAIN_CHR_TYPE_UDP: if (def->data.udp.bindService || def->data.udp.bindHost) { virBufferAddLit(buf, "data.udp.bindService) - virBufferEscapeString(buf, " host=3D'%s'", def->data.udp.b= indHost); - if (def->data.udp.bindService) - virBufferEscapeString(buf, " service=3D'%s'", def->data.ud= p.bindService); + virBufferEscapeString(buf, " host=3D'%s'", def->data.udp.bindH= ost); + virBufferEscapeString(buf, " service=3D'%s'", def->data.udp.bi= ndService); virBufferAddLit(buf, "/>\n"); } =20 if (def->data.udp.connectService || def->data.udp.connectHost) { virBufferAddLit(buf, "data.udp.connectService) - virBufferEscapeString(buf, " host=3D'%s'", def->data.udp.c= onnectHost); - if (def->data.udp.connectService) - virBufferEscapeString(buf, " service=3D'%s'", def->data.ud= p.connectService); + virBufferEscapeString(buf, " host=3D'%s'", def->data.udp.conne= ctHost); + virBufferEscapeString(buf, " service=3D'%s'", def->data.udp.co= nnectService); virBufferAddLit(buf, "/>\n"); } break; diff --git a/tests/genericxml2xmloutdata/generic-chardev-udp.xml b/tests/ge= nericxml2xmloutdata/generic-chardev-udp.xml index c4a719f2f..c9b3e5550 100644 --- a/tests/genericxml2xmloutdata/generic-chardev-udp.xml +++ b/tests/genericxml2xmloutdata/generic-chardev-udp.xml @@ -29,7 +29,7 @@ - + --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list