From 8c383ea96086dc4affd1ef44e0d3fd455514b427 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 28 Feb 2022 15:00:00 +0100 Subject: [PATCH] virsh: doSave: Use if-else instead of ternary operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- tools/virsh-domain.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 4c90f40f86..607eb973ac 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4213,6 +4213,7 @@ doSave(void *opaque) unsigned int flags = 0; const char *xmlfile = NULL; g_autofree char *xml = NULL; + int rc; #ifndef WIN32 sigset_t sigmask, oldsigmask; @@ -4244,9 +4245,13 @@ doSave(void *opaque) goto out; } - if (((flags || xml) - ? virDomainSaveFlags(dom, to, xml, flags) - : virDomainSave(dom, to)) < 0) { + if (flags || xml) { + rc = virDomainSaveFlags(dom, to, xml, flags); + } else { + rc = virDomainSave(dom, to); + } + + if (rc < 0) { vshError(ctl, _("Failed to save domain '%s' to %s"), name, to); goto out; }