From 3a00632667315a769fe594df1cf34d1a77ca2809 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 28 Feb 2022 15:00:00 +0100 Subject: [PATCH] virsh: cmdRestore: 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 607eb973ac..732690ec44 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5313,6 +5313,7 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) const char *xmlfile = NULL; g_autofree char *xml = NULL; virshControl *priv = ctl->privData; + int rc; if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0) return false; @@ -5333,9 +5334,13 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0) return false; - if (((flags || xml) - ? virDomainRestoreFlags(priv->conn, from, xml, flags) - : virDomainRestore(priv->conn, from)) < 0) { + if (flags || xml) { + rc = virDomainRestoreFlags(priv->conn, from, xml, flags); + } else { + rc = virDomainRestore(priv->conn, from); + } + + if (rc < 0) { vshError(ctl, _("Failed to restore domain from %s"), from); return false; }