From d1f8d6edbff574e213a04ad08b54c52bc711e147 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Fri, 20 Jul 2012 13:09:07 +0100 Subject: [PATCH] Add missing "%s" format string to constant error messages in libxl driver Updates the libxl driver code so that it passes "%s" as the format string whenever raising an error message with a const string. --- src/libxl/libxl_conf.c | 6 +++--- src/libxl/libxl_driver.c | 26 ++++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 201df7549b..a41dd5e24c 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -397,7 +397,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config) * only 32 can be represented. */ if (def->maxvcpus > 32 || def->vcpus > 32) { - libxlError(VIR_ERR_INTERNAL_ERROR, + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("This version of libxenlight only supports 32 " "vcpus per domain")); return -1; @@ -917,13 +917,13 @@ libxlMakeCapabilities(libxl_ctx *ctx) regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED); if (libxl_get_physinfo(ctx, &phy_info) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to get node physical info from libxenlight")); return NULL; } if ((ver_info = libxl_get_version_info(ctx)) == NULL) { - libxlError(VIR_ERR_INTERNAL_ERROR, + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to get version info from libxenlight")); return NULL; } diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 4d1db3aad9..72fa7388dc 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -168,13 +168,13 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info) struct utsname utsname; if (libxl_get_physinfo(&driver->ctx, &phy_info)) { - libxlError(VIR_ERR_INTERNAL_ERROR, + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("libxl_get_physinfo_info failed")); return -1; } if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { - libxlError(VIR_ERR_INTERNAL_ERROR, + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("libxl_get_version_info failed")); return -1; } @@ -696,7 +696,7 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, if (libxl_userdata_store(&priv->ctx, domid, "libvirt-xml", (uint8_t *)dom_xml, strlen(dom_xml) + 1)) { - libxlError(VIR_ERR_INTERNAL_ERROR, + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("libxenlight failed to store userdata")); goto error; } @@ -1851,13 +1851,13 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm, hdr.xmlLen = xml_len; if (safewrite(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) { - libxlError(VIR_ERR_OPERATION_FAILED, + libxlError(VIR_ERR_OPERATION_FAILED, "%s", _("Failed to write save file header")); goto cleanup; } if (safewrite(fd, xml, xml_len) != xml_len) { - libxlError(VIR_ERR_OPERATION_FAILED, + libxlError(VIR_ERR_OPERATION_FAILED, "%s", _("Failed to write xml description")); goto cleanup; } @@ -2250,7 +2250,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, } if (!nvcpus) { - libxlError(VIR_ERR_INVALID_ARG, _("nvcpus is zero")); + libxlError(VIR_ERR_INVALID_ARG, "%s", _("nvcpus is zero")); return -1; } @@ -2813,7 +2813,7 @@ libxlDomainUndefineFlags(virDomainPtr dom, if (virFileExists(name)) { if (flags & VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) { if (unlink(name) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to remove domain managed save image")); goto cleanup; } @@ -3179,7 +3179,7 @@ libxlDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) } orig = vmdef->disks[i]; if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM)) { - libxlError(VIR_ERR_INVALID_ARG, + libxlError(VIR_ERR_INVALID_ARG, "%s", _("this disk doesn't support update")); goto cleanup; } @@ -3378,12 +3378,14 @@ libxlNodeGetFreeMemory(virConnectPtr conn) libxlDriverPrivatePtr driver = conn->privateData; if (libxl_get_physinfo(&driver->ctx, &phy_info)) { - libxlError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_physinfo_info failed")); + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", + _("libxl_get_physinfo_info failed")); return 0; } if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { - libxlError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_version_info failed")); + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", + _("libxl_get_version_info failed")); return 0; } @@ -3621,7 +3623,7 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom, } if (sched_id != XEN_SCHEDULER_CREDIT) { - libxlError(VIR_ERR_INTERNAL_ERROR, + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("Only 'credit' scheduler is supported")); goto cleanup; } @@ -3707,7 +3709,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom, } if (sched_id != XEN_SCHEDULER_CREDIT) { - libxlError(VIR_ERR_INTERNAL_ERROR, + libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("Only 'credit' scheduler is supported")); goto cleanup; } -- GitLab