@@ -5203,41 +5203,44 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
xen_commandline_t xen_commandline;
} u;
long xen_version;
+ int r = 0;
libxl_version_info *info = &ctx->version_info;
if (info->xen_version_extra != NULL)
goto out;
xen_version = xc_version(ctx->xch, XENVER_version, NULL);
+ if (xen_version < 0) goto out;
+ r = xc_version(ctx->xch, XENVER_extraversion, &u.xen_extra);
+ if (r < 0) goto out;
+ r = xc_version(ctx->xch, XENVER_compile_info, &u.xen_cc);
+ if (r < 0) goto out;
+ r = xc_version(ctx->xch, XENVER_capabilities, &u.xen_caps);
+ if (r < 0) goto out;
+ r = xc_version(ctx->xch, XENVER_changeset, &u.xen_chgset);
+ if (r < 0) goto out;
+ r = xc_version(ctx->xch, XENVER_platform_parameters, &u.p_parms);
+ if (r < 0) goto out;
+ r = info->pagesize = xc_version(ctx->xch, XENVER_pagesize, NULL);
+ if (r < 0) goto out;
+ r = xc_version(ctx->xch, XENVER_commandline, &u.xen_commandline);
+ if (r < 0) goto out;
+
info->xen_version_major = xen_version >> 16;
info->xen_version_minor = xen_version & 0xFF;
-
- xc_version(ctx->xch, XENVER_extraversion, &u.xen_extra);
info->xen_version_extra = libxl__strdup(NOGC, u.xen_extra);
-
- xc_version(ctx->xch, XENVER_compile_info, &u.xen_cc);
info->compiler = libxl__strdup(NOGC, u.xen_cc.compiler);
info->compile_by = libxl__strdup(NOGC, u.xen_cc.compile_by);
info->compile_domain = libxl__strdup(NOGC, u.xen_cc.compile_domain);
info->compile_date = libxl__strdup(NOGC, u.xen_cc.compile_date);
-
- xc_version(ctx->xch, XENVER_capabilities, &u.xen_caps);
info->capabilities = libxl__strdup(NOGC, u.xen_caps);
-
- xc_version(ctx->xch, XENVER_changeset, &u.xen_chgset);
info->changeset = libxl__strdup(NOGC, u.xen_chgset);
-
- xc_version(ctx->xch, XENVER_platform_parameters, &u.p_parms);
info->virt_start = u.p_parms.virt_start;
-
- info->pagesize = xc_version(ctx->xch, XENVER_pagesize, NULL);
-
- xc_version(ctx->xch, XENVER_commandline, &u.xen_commandline);
info->commandline = libxl__strdup(NOGC, u.xen_commandline);
out:
GC_FREE;
- return info;
+ return r < 0 ? NULL : info;
}
libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,