g_autofree char *desc = NULL;
const vshCmdOpt *opt = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- bool ret = false;
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
unsigned int queryflags = 0;
return false;
if ((state = virshDomainState(ctl, dom, NULL)) < 0)
- goto cleanup;
+ return false;
if (title)
type = VIR_DOMAIN_METADATA_TITLE;
if (!desc) {
desc = virshGetDomainDescription(ctl, dom, title, queryflags);
if (!desc)
- goto cleanup;
+ return false;
}
if (edit) {
/* Create and open the temporary file. */
if (!(tmp = vshEditWriteToTempFile(ctl, desc)))
- goto cleanup;
+ return false;
/* Start the editor. */
if (vshEditFile(ctl, tmp) == -1)
- goto cleanup;
+ return false;
/* Read back the edited file. */
if (!(desc_edited = vshEditReadBackFile(ctl, tmp)))
- goto cleanup;
+ return false;
/* strip a possible newline at the end of file; some
* editors enforce a newline, this makes editing the title
vshPrintExtra(ctl, "%s",
title ? _("Domain title not changed\n") :
_("Domain description not changed\n"));
- ret = true;
- goto cleanup;
+ return true;
}
VIR_FREE(desc);
vshError(ctl, "%s",
title ? _("Failed to set new domain title") :
_("Failed to set new domain description"));
- goto cleanup;
+ return false;
}
vshPrintExtra(ctl, "%s",
title ? _("Domain title updated successfully") :
} else {
desc = virshGetDomainDescription(ctl, dom, title, queryflags);
if (!desc)
- goto cleanup;
+ return false;
if (strlen(desc) > 0)
vshPrint(ctl, "%s", desc);
virDomainGetName(dom));
}
- ret = true;
- cleanup:
- return ret;
+ return true;
}