mirror of https://gitee.com/openkylin/libvirt.git
testQemuInfoInitArgs: Report error if path to 'latest' caps for an arch is NULL
When looking up the 'latest' caps they might not be present. Report an error instead of crashing. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
1bb7b3aa9c
commit
4560736c9c
|
@ -772,6 +772,12 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
|
||||||
|
|
||||||
if (STREQ(info->args.capsver, "latest")) {
|
if (STREQ(info->args.capsver, "latest")) {
|
||||||
capsfile = g_strdup(virHashLookup(info->conf->capslatest, info->args.capsarch));
|
capsfile = g_strdup(virHashLookup(info->conf->capslatest, info->args.capsarch));
|
||||||
|
|
||||||
|
if (!capsfile) {
|
||||||
|
fprintf(stderr, "'latest' caps for '%s' were not found\n", info->args.capsarch);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
stripmachinealiases = true;
|
stripmachinealiases = true;
|
||||||
} else {
|
} else {
|
||||||
capsfile = g_strdup_printf("%s/caps_%s.%s.xml",
|
capsfile = g_strdup_printf("%s/caps_%s.%s.xml",
|
||||||
|
|
Loading…
Reference in New Issue