virsh: doSave: Use if-else instead of ternary operator

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-02-28 15:00:00 +01:00
parent 38b600166f
commit 8c383ea960
1 changed files with 8 additions and 3 deletions

View File

@ -4213,6 +4213,7 @@ doSave(void *opaque)
unsigned int flags = 0; unsigned int flags = 0;
const char *xmlfile = NULL; const char *xmlfile = NULL;
g_autofree char *xml = NULL; g_autofree char *xml = NULL;
int rc;
#ifndef WIN32 #ifndef WIN32
sigset_t sigmask, oldsigmask; sigset_t sigmask, oldsigmask;
@ -4244,9 +4245,13 @@ doSave(void *opaque)
goto out; goto out;
} }
if (((flags || xml) if (flags || xml) {
? virDomainSaveFlags(dom, to, xml, flags) rc = virDomainSaveFlags(dom, to, xml, flags);
: virDomainSave(dom, to)) < 0) { } else {
rc = virDomainSave(dom, to);
}
if (rc < 0) {
vshError(ctl, _("Failed to save domain '%s' to %s"), name, to); vshError(ctl, _("Failed to save domain '%s' to %s"), name, to);
goto out; goto out;
} }