From a3ef5414ed8f0f97241d4ea852c6f8463d16e663 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 28 Feb 2022 18:32:30 +0100 Subject: [PATCH] virsh: cmdDesc: Use separate flags variable for getters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The getters have a different set of flags. Add a variable for the getter to avoid having to construct flags when calling the getter. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- tools/virsh-domain.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 2d1889c71e..cac50dba51 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8341,12 +8341,15 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; bool ret = false; unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; + unsigned int queryflags = 0; VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); - if (config) + if (config) { flags |= VIR_DOMAIN_AFFECT_CONFIG; + queryflags |= VIR_DOMAIN_XML_INACTIVE; + } if (live) flags |= VIR_DOMAIN_AFFECT_LIVE; @@ -8370,8 +8373,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) if (edit || desc) { if (!desc) { - desc = virshGetDomainDescription(ctl, dom, title, - config?VIR_DOMAIN_XML_INACTIVE:0); + desc = virshGetDomainDescription(ctl, dom, title, queryflags); if (!desc) goto cleanup; } @@ -8420,8 +8422,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) title ? _("Domain title updated successfully") : _("Domain description updated successfully")); } else { - desc = virshGetDomainDescription(ctl, dom, title, - config?VIR_DOMAIN_XML_INACTIVE:0); + desc = virshGetDomainDescription(ctl, dom, title, queryflags); if (!desc) goto cleanup;