I compiled libvirt with the latest gcc in rawhide and these CFLAGS: -O -Wall -Wcast-align -Wextra -Wformat -Wformat-security -Winit-self -Winline -Wmissing-prototypes -Wnested-externs -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings and ended up with a whole bunch of these warnings: virsh.c:6896: warning: format not a string literal and no format arguments Here's the patch: Avoid new format string warnings. * src/virsh.c: Add "%s" where needed. * src/proxy_internal.c: Likewise. --- src/proxy_internal.c | 8 ++-- src/virsh.c | 148 +++++++++++++++++++++++++------------------------- 2 files changed, 79 insertions(+), 77 deletions(-) diff --git a/src/proxy_internal.c b/src/proxy_internal.c index 7f902c5..e0e5631 100644 --- a/src/proxy_internal.c +++ b/src/proxy_internal.c @@ -499,10 +499,10 @@ retry: */ if ((res == NULL) || (res->version != PROXY_PROTO_VERSION) || (res->len < sizeof(virProxyPacket))) { - fprintf(stderr, - _("Communication error with proxy: malformed packet\n")); - xenProxyClose(conn); - return(-1); + fprintf(stderr, "%s", + _("Communication error with proxy: malformed packet\n")); + xenProxyClose(conn); + return(-1); } if (res->serial != serial) { TODO /* Asynchronous communication */ diff --git a/src/virsh.c b/src/virsh.c index 6604eea..cbe3e8e 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -351,7 +351,7 @@ cmdMonitorProgress(vshControl *ctl, vshCmd *cmd, virJobPtr job, virJobInfoPtr in do { if (virJobGetInfo(job, info) < 0) { - vshError(ctl, FALSE, _("Failed to get job status")); + vshError(ctl, FALSE, "%s", _("Failed to get job status")); return -1; } @@ -437,7 +437,7 @@ cmdHelp(vshControl * ctl, vshCmd * cmd) if (!cmdname) { vshCmdDef *def; - vshPrint(ctl, _("Commands:\n\n")); + vshPrint(ctl, "%s", _("Commands:\n\n")); for (def = commands; def->name; def++) vshPrint(ctl, " %-15s %s\n", def->name, N_(vshCmddefGetInfo(def, "help"))); @@ -522,7 +522,7 @@ cmdConnect(vshControl * ctl, vshCmd * cmd) if (ctl->conn) { if (virConnectClose(ctl->conn) != 0) { - vshError(ctl, FALSE, + vshError(ctl, FALSE, "%s", _("Failed to disconnect from the hypervisor")); return FALSE; } @@ -542,7 +542,7 @@ cmdConnect(vshControl * ctl, vshCmd * cmd) } if (!ctl->conn) - vshError(ctl, FALSE, _("Failed to connect to the hypervisor")); + vshError(ctl, FALSE, "%s", _("Failed to connect to the hypervisor")); return ctl->conn ? TRUE : FALSE; } @@ -601,7 +601,7 @@ cmdConsole(vshControl * ctl, vshCmd * cmd) if (vshRunConsole((const char *)obj->stringval) == 0) ret = TRUE; } else { - vshPrintExtra(ctl, _("No console available for domain\n")); + vshPrintExtra(ctl, "%s", _("No console available for domain\n")); } xmlXPathFreeObject(obj); @@ -619,7 +619,7 @@ cmdConsole(vshControl * ctl, vshCmd * cmd) static int cmdConsole(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) { - vshError (ctl, FALSE, _("console not implemented on this platform")); + vshError (ctl, FALSE, "%s", _("console not implemented on this platform")); return FALSE; } @@ -659,14 +659,14 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) if (active) { maxid = virConnectNumOfDomains(ctl->conn); if (maxid < 0) { - vshError(ctl, FALSE, _("Failed to list active domains")); + vshError(ctl, FALSE, "%s", _("Failed to list active domains")); return FALSE; } if (maxid) { ids = vshMalloc(ctl, sizeof(int) * maxid); if ((maxid = virConnectListDomains(ctl->conn, &ids[0], maxid)) < 0) { - vshError(ctl, FALSE, _("Failed to list active domains")); + vshError(ctl, FALSE, "%s", _("Failed to list active domains")); free(ids); return FALSE; } @@ -677,7 +677,7 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) if (inactive) { maxname = virConnectNumOfDefinedDomains(ctl->conn); if (maxname < 0) { - vshError(ctl, FALSE, _("Failed to list inactive domains")); + vshError(ctl, FALSE, "%s", _("Failed to list inactive domains")); if (ids) free(ids); return FALSE; @@ -686,7 +686,7 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) names = vshMalloc(ctl, sizeof(char *) * maxname); if ((maxname = virConnectListDefinedDomains(ctl->conn, names, maxname)) < 0) { - vshError(ctl, FALSE, _("Failed to list inactive domains")); + vshError(ctl, FALSE, "%s", _("Failed to list inactive domains")); if (ids) free(ids); free(names); @@ -1004,7 +1004,7 @@ cmdCreate(vshControl * ctl, vshCmd * cmd) virDomainGetName(dom), from); virDomainFree(dom); } else if (info.state == VIR_JOB_CANCELLED) { - vshError(ctl, FALSE, _("Cancelled domain create operation")); + vshError(ctl, FALSE, "%s", _("Cancelled domain create operation")); ret = FALSE; } else { vshError(ctl, FALSE, _("Failed to create domain from %s"), from); @@ -1145,7 +1145,7 @@ cmdStart(vshControl * ctl, vshCmd * cmd) return FALSE; if (virDomainGetID(dom) != (unsigned int)-1) { - vshError(ctl, FALSE, _("Domain is already active")); + vshError(ctl, FALSE, "%s", _("Domain is already active")); virDomainFree(dom); return FALSE; } @@ -1172,7 +1172,7 @@ cmdStart(vshControl * ctl, vshCmd * cmd) vshPrint(ctl, _("Domain %s started\n"), virDomainGetName(dom)); } else if (info.state == VIR_JOB_CANCELLED) { - vshError(ctl, FALSE, _("Cancelled domain start operation")); + vshError(ctl, FALSE, "%s", _("Cancelled domain start operation")); ret = FALSE; } else { vshError(ctl, FALSE, _("Failed to start domain %s"), @@ -1248,7 +1248,7 @@ cmdSave(vshControl * ctl, vshCmd * cmd) if (info.state == VIR_JOB_COMPLETE) { vshPrint(ctl, _("Domain %s saved to %s\n"), name, to); } else if (info.state == VIR_JOB_CANCELLED) { - vshError(ctl, FALSE, _("Cancelled domain save operation")); + vshError(ctl, FALSE, "%s", _("Cancelled domain save operation")); ret = FALSE; } else { vshError(ctl, FALSE, _("Failed to save domain %s to %s"), name, to); @@ -1313,7 +1313,7 @@ cmdSchedinfo(vshControl * ctl, vshCmd * cmd) if(vshCommandOptBool(cmd, "weight")) { weight = vshCommandOptInt(cmd, "weight", &weightfound); if (!weightfound) { - vshError(ctl, FALSE, _("Invalid value of weight")); + vshError(ctl, FALSE, "%s", _("Invalid value of weight")); goto cleanup; } else { nr_inputparams++; @@ -1323,7 +1323,7 @@ cmdSchedinfo(vshControl * ctl, vshCmd * cmd) if(vshCommandOptBool(cmd, "cap")) { cap = vshCommandOptInt(cmd, "cap", &capfound); if (!capfound) { - vshError(ctl, FALSE, _("Invalid value of cap")); + vshError(ctl, FALSE, "%s", _("Invalid value of cap")); goto cleanup; } else { nr_inputparams++; @@ -1468,7 +1468,7 @@ cmdRestore(vshControl * ctl, vshCmd * cmd) if (info.state == VIR_JOB_COMPLETE) { vshPrint(ctl, _("Domain restored from %s\n"),from); } else if (info.state == VIR_JOB_CANCELLED) { - vshError(ctl, FALSE, _("Cancelled domain restore operation")); + vshError(ctl, FALSE, "%s", _("Cancelled domain restore operation")); ret = FALSE; } else { vshError(ctl, FALSE, _("Failed to restore domain from %s"), from); @@ -1541,7 +1541,7 @@ cmdDump(vshControl * ctl, vshCmd * cmd) if (info.state == VIR_JOB_COMPLETE) { vshPrint(ctl, _("Domain %s dumped to %s\n"), name, to); } else if (info.state == VIR_JOB_CANCELLED) { - vshError(ctl, FALSE, _("Cancelled domain dump operation")); + vshError(ctl, FALSE, "%s", _("Cancelled domain dump operation")); ret = FALSE; } else { vshError(ctl, FALSE, _("Failed to core dump domain %s to %s"), @@ -1913,7 +1913,7 @@ cmdVcpuinfo(vshControl * ctl, vshCmd * cmd) } } else { if (info.state == VIR_DOMAIN_SHUTOFF) { - vshError(ctl, FALSE, + vshError(ctl, FALSE, "%s", _("Domain shut off, virtual CPUs not present.")); } ret = FALSE; @@ -1993,7 +1993,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd) * numbers and give an intelligent error message if not. */ if (cpulist[0] == '\0') { - vshError(ctl, FALSE, _("cpulist: Invalid format. Empty string.")); + vshError(ctl, FALSE, "%s", _("cpulist: Invalid format. Empty string.")); virDomainFree (dom); return FALSE; } @@ -2085,7 +2085,7 @@ cmdSetvcpus(vshControl * ctl, vshCmd * cmd) count = vshCommandOptInt(cmd, "count", &count); if (count <= 0) { - vshError(ctl, FALSE, _("Invalid number of virtual CPUs.")); + vshError(ctl, FALSE, "%s", _("Invalid number of virtual CPUs.")); virDomainFree(dom); return FALSE; } @@ -2097,7 +2097,7 @@ cmdSetvcpus(vshControl * ctl, vshCmd * cmd) } if (count > maxcpu) { - vshError(ctl, FALSE, _("Too many virtual CPUs.")); + vshError(ctl, FALSE, "%s", _("Too many virtual CPUs.")); virDomainFree(dom); return FALSE; } @@ -2149,7 +2149,7 @@ cmdSetmem(vshControl * ctl, vshCmd * cmd) if (virDomainGetInfo(dom, &info) != 0) { virDomainFree(dom); - vshError(ctl, FALSE, _("Unable to verify MaxMemorySize")); + vshError(ctl, FALSE, "%s", _("Unable to verify MaxMemorySize")); return FALSE; } @@ -2206,20 +2206,20 @@ cmdSetmaxmem(vshControl * ctl, vshCmd * cmd) if (virDomainGetInfo(dom, &info) != 0) { virDomainFree(dom); - vshError(ctl, FALSE, _("Unable to verify current MemorySize")); + vshError(ctl, FALSE, "%s", _("Unable to verify current MemorySize")); return FALSE; } if (kilobytes < info.memory) { if (virDomainSetMemory(dom, kilobytes) != 0) { virDomainFree(dom); - vshError(ctl, FALSE, _("Unable to shrink current MemorySize")); + vshError(ctl, FALSE, "%s", _("Unable to shrink current MemorySize")); return FALSE; } } if (virDomainSetMaxMemory(dom, kilobytes) != 0) { - vshError(ctl, FALSE, _("Unable to change MaxMemorySize")); + vshError(ctl, FALSE, "%s", _("Unable to change MaxMemorySize")); ret = FALSE; } @@ -2246,7 +2246,7 @@ cmdNodeinfo(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) return FALSE; if (virNodeGetInfo(ctl->conn, &info) < 0) { - vshError(ctl, FALSE, _("failed to get node information")); + vshError(ctl, FALSE, "%s", _("failed to get node information")); return FALSE; } vshPrint(ctl, "%-20s %s\n", _("CPU model:"), info.model); @@ -2280,7 +2280,7 @@ cmdCapabilities (vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) return FALSE; if ((caps = virConnectGetCapabilities (ctl->conn)) == NULL) { - vshError(ctl, FALSE, _("failed to get capabilities")); + vshError(ctl, FALSE, "%s", _("failed to get capabilities")); return FALSE; } vshPrint (ctl, "%s\n", caps); @@ -2422,7 +2422,7 @@ cmdDomuuid(vshControl * ctl, vshCmd * cmd) if (virDomainGetUUIDString(dom, uuid) != -1) vshPrint(ctl, "%s\n", uuid); else - vshError(ctl, FALSE, _("failed to get domain UUID")); + vshError(ctl, FALSE, "%s", _("failed to get domain UUID")); return TRUE; } @@ -2463,7 +2463,7 @@ cmdMigrate (vshControl *ctl, vshCmd *cmd) desturi = vshCommandOptString (cmd, "desturi", &found); if (!found) { - vshError (ctl, FALSE, _("migrate: Missing desturi")); + vshError (ctl, FALSE, "%s", _("migrate: Missing desturi")); goto done; } @@ -2599,7 +2599,7 @@ cmdNetworkCreate(vshControl * ctl, vshCmd * cmd) virNetworkGetName(dom), from); virNetworkFree(dom); } else if (info.state == VIR_JOB_CANCELLED) { - vshError(ctl, FALSE, _("Cancelled network create operation")); + vshError(ctl, FALSE, "%s", _("Cancelled network create operation")); ret = FALSE; } else { vshError(ctl, FALSE, _("Failed to create network from %s"), from); @@ -2783,7 +2783,7 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) if (active) { maxactive = virConnectNumOfNetworks(ctl->conn); if (maxactive < 0) { - vshError(ctl, FALSE, _("Failed to list active networks")); + vshError(ctl, FALSE, "%s", _("Failed to list active networks")); return FALSE; } if (maxactive) { @@ -2791,7 +2791,7 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) if ((maxactive = virConnectListNetworks(ctl->conn, activeNames, maxactive)) < 0) { - vshError(ctl, FALSE, _("Failed to list active networks")); + vshError(ctl, FALSE, "%s", _("Failed to list active networks")); free(activeNames); return FALSE; } @@ -2802,7 +2802,7 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) if (inactive) { maxinactive = virConnectNumOfDefinedNetworks(ctl->conn); if (maxinactive < 0) { - vshError(ctl, FALSE, _("Failed to list inactive networks")); + vshError(ctl, FALSE, "%s", _("Failed to list inactive networks")); if (activeNames) free(activeNames); return FALSE; @@ -2811,7 +2811,7 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive); if ((maxinactive = virConnectListDefinedNetworks(ctl->conn, inactiveNames, maxinactive)) < 0) { - vshError(ctl, FALSE, _("Failed to list inactive networks")); + vshError(ctl, FALSE, "%s", _("Failed to list inactive networks")); if (activeNames) free(activeNames); free(inactiveNames); @@ -2961,7 +2961,7 @@ cmdNetworkStart(vshControl * ctl, vshCmd * cmd) vshPrint(ctl, _("Network %s started\n"), virNetworkGetName(network)); } else if (info.state == VIR_JOB_CANCELLED) { - vshError(ctl, FALSE, _("Cancelled network start operation")); + vshError(ctl, FALSE, "%s", _("Cancelled network start operation")); ret = FALSE; } else { vshError(ctl, FALSE, _("Failed to start network %s"), @@ -3053,7 +3053,7 @@ cmdNetworkUuid(vshControl * ctl, vshCmd * cmd) if (virNetworkGetUUIDString(network, uuid) != -1) vshPrint(ctl, "%s\n", uuid); else - vshError(ctl, FALSE, _("failed to get network UUID")); + vshError(ctl, FALSE, "%s", _("failed to get network UUID")); return TRUE; } @@ -3567,7 +3567,7 @@ cmdPoolList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) if (active) { maxactive = virConnectNumOfStoragePools(ctl->conn); if (maxactive < 0) { - vshError(ctl, FALSE, _("Failed to list active pools")); + vshError(ctl, FALSE, "%s", _("Failed to list active pools")); return FALSE; } if (maxactive) { @@ -3575,7 +3575,7 @@ cmdPoolList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) if ((maxactive = virConnectListStoragePools(ctl->conn, activeNames, maxactive)) < 0) { - vshError(ctl, FALSE, _("Failed to list active pools")); + vshError(ctl, FALSE, "%s", _("Failed to list active pools")); free(activeNames); return FALSE; } @@ -3586,7 +3586,7 @@ cmdPoolList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) if (inactive) { maxinactive = virConnectNumOfDefinedStoragePools(ctl->conn); if (maxinactive < 0) { - vshError(ctl, FALSE, _("Failed to list inactive pools")); + vshError(ctl, FALSE, "%s", _("Failed to list inactive pools")); if (activeNames) free(activeNames); return FALSE; @@ -3595,7 +3595,7 @@ cmdPoolList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive); if ((maxinactive = virConnectListDefinedStoragePools(ctl->conn, inactiveNames, maxinactive)) < 0) { - vshError(ctl, FALSE, _("Failed to list inactive pools")); + vshError(ctl, FALSE, "%s", _("Failed to list inactive pools")); if (activeNames) free(activeNames); free(inactiveNames); @@ -3701,7 +3701,7 @@ cmdPoolDiscover(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) type, 0, &xmlDesc)) < 0) { - vshError(ctl, FALSE, _("Failed to discover pools")); + vshError(ctl, FALSE, "%s", _("Failed to discover pools")); return FALSE; } @@ -3934,7 +3934,7 @@ cmdPoolUuid(vshControl * ctl, vshCmd * cmd) if (virStoragePoolGetUUIDString(pool, uuid) != -1) vshPrint(ctl, "%s\n", uuid); else - vshError(ctl, FALSE, _("failed to get pool UUID")); + vshError(ctl, FALSE, "%s", _("failed to get pool UUID")); return TRUE; } @@ -4310,7 +4310,7 @@ cmdVolList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) maxactive = virStoragePoolNumOfVolumes(pool); if (maxactive < 0) { virStoragePoolFree(pool); - vshError(ctl, FALSE, _("Failed to list active vols")); + vshError(ctl, FALSE, "%s", _("Failed to list active vols")); return FALSE; } if (maxactive) { @@ -4318,7 +4318,7 @@ cmdVolList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) if ((maxactive = virStoragePoolListVolumes(pool, activeNames, maxactive)) < 0) { - vshError(ctl, FALSE, _("Failed to list active vols")); + vshError(ctl, FALSE, "%s", _("Failed to list active vols")); free(activeNames); virStoragePoolFree(pool); return FALSE; @@ -4491,7 +4491,7 @@ cmdVersion(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) hvType = virConnectGetType(ctl->conn); if (hvType == NULL) { - vshError(ctl, FALSE, _("failed to get hypervisor type")); + vshError(ctl, FALSE, "%s", _("failed to get hypervisor type")); return FALSE; } @@ -4505,7 +4505,7 @@ cmdVersion(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) ret = virGetVersion(&libVersion, hvType, &apiVersion); if (ret < 0) { - vshError(ctl, FALSE, _("failed to get the library version")); + vshError(ctl, FALSE, "%s", _("failed to get the library version")); return FALSE; } major = libVersion / 1000000; @@ -4524,7 +4524,7 @@ cmdVersion(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) ret = virConnectGetVersion(ctl->conn, &hvVersion); if (ret < 0) { - vshError(ctl, FALSE, _("failed to get the hypervisor version")); + vshError(ctl, FALSE, "%s", _("failed to get the hypervisor version")); return FALSE; } if (hvVersion == 0) { @@ -4561,7 +4561,7 @@ cmdHostname (vshControl *ctl, vshCmd *cmd ATTRIBUTE_UNUSED) hostname = virConnectGetHostname (ctl->conn); if (hostname == NULL) { - vshError(ctl, FALSE, _("failed to get hostname")); + vshError(ctl, FALSE, "%s", _("failed to get hostname")); return FALSE; } @@ -4590,7 +4590,7 @@ cmdURI (vshControl *ctl, vshCmd *cmd ATTRIBUTE_UNUSED) uri = virConnectGetURI (ctl->conn); if (uri == NULL) { - vshError(ctl, FALSE, _("failed to get URI")); + vshError(ctl, FALSE, "%s", _("failed to get URI")); return FALSE; } @@ -5016,12 +5016,12 @@ cmdDetachInterface(vshControl * ctl, vshCmd * cmd) XML_PARSE_NOWARNING); free(doc); if (!xml) { - vshError(ctl, FALSE, _("Failed to get interface information")); + vshError(ctl, FALSE, "%s", _("Failed to get interface information")); goto cleanup; } ctxt = xmlXPathNewContext(xml); if (!ctxt) { - vshError(ctl, FALSE, _("Failed to get interface information")); + vshError(ctl, FALSE, "%s", _("Failed to get interface information")); goto cleanup; } @@ -5057,12 +5057,12 @@ cmdDetachInterface(vshControl * ctl, vshCmd * cmd) hit: xml_buf = xmlBufferCreate(); if (!xml_buf) { - vshError(ctl, FALSE, _("Failed to allocate memory")); + vshError(ctl, FALSE, "%s", _("Failed to allocate memory")); goto cleanup; } if(xmlNodeDump(xml_buf, xml, obj->nodesetval->nodeTab[i], 0, 0) < 0){ - vshError(ctl, FALSE, _("Failed to create XML")); + vshError(ctl, FALSE, "%s", _("Failed to create XML")); goto cleanup; } @@ -5298,19 +5298,19 @@ cmdDetachDisk(vshControl * ctl, vshCmd * cmd) XML_PARSE_NOWARNING); free(doc); if (!xml) { - vshError(ctl, FALSE, _("Failed to get disk information")); + vshError(ctl, FALSE, "%s", _("Failed to get disk information")); goto cleanup; } ctxt = xmlXPathNewContext(xml); if (!ctxt) { - vshError(ctl, FALSE, _("Failed to get disk information")); + vshError(ctl, FALSE, "%s", _("Failed to get disk information")); goto cleanup; } obj = xmlXPathEval(BAD_CAST "/domain/devices/disk", ctxt); if ((obj == NULL) || (obj->type != XPATH_NODESET) || (obj->nodesetval == NULL) || (obj->nodesetval->nodeNr == 0)) { - vshError(ctl, FALSE, _("Failed to get disk information")); + vshError(ctl, FALSE, "%s", _("Failed to get disk information")); goto cleanup; } @@ -5335,12 +5335,12 @@ cmdDetachDisk(vshControl * ctl, vshCmd * cmd) hit: xml_buf = xmlBufferCreate(); if (!xml_buf) { - vshError(ctl, FALSE, _("Failed to allocate memory")); + vshError(ctl, FALSE, "%s", _("Failed to allocate memory")); goto cleanup; } if(xmlNodeDump(xml_buf, xml, obj->nodesetval->nodeTab[i], 0, 0) < 0){ - vshError(ctl, FALSE, _("Failed to create XML")); + vshError(ctl, FALSE, "%s", _("Failed to create XML")); goto cleanup; } @@ -5742,7 +5742,7 @@ vshCommandOptDomainBy(vshControl * ctl, vshCmd * cmd, const char *optname, int id; if (!(n = vshCommandOptString(cmd, optname, NULL))) { - vshError(ctl, FALSE, _("undefined domain name or id")); + vshError(ctl, FALSE, "%s", _("undefined domain name or id")); return NULL; } @@ -5787,7 +5787,7 @@ vshCommandOptNetworkBy(vshControl * ctl, vshCmd * cmd, const char *optname, char *n; if (!(n = vshCommandOptString(cmd, optname, NULL))) { - vshError(ctl, FALSE, _("undefined network name")); + vshError(ctl, FALSE, "%s", _("undefined network name")); return NULL; } @@ -5824,7 +5824,7 @@ vshCommandOptPoolBy(vshControl * ctl, vshCmd * cmd, const char *optname, char *n; if (!(n = vshCommandOptString(cmd, optname, NULL))) { - vshError(ctl, FALSE, _("undefined pool name")); + vshError(ctl, FALSE, "%s", _("undefined pool name")); return NULL; } @@ -5865,12 +5865,12 @@ vshCommandOptVolBy(vshControl * ctl, vshCmd * cmd, int found; if (!(n = vshCommandOptString(cmd, optname, NULL))) { - vshError(ctl, FALSE, _("undefined vol name")); + vshError(ctl, FALSE, "%s", _("undefined vol name")); return NULL; } if (!(p = vshCommandOptString(cmd, pooloptname, &found)) && found) { - vshError(ctl, FALSE, _("undefined pool name")); + vshError(ctl, FALSE, "%s", _("undefined pool name")); return NULL; } @@ -6006,7 +6006,7 @@ vshCommandGetToken(vshControl * ctl, char *str, char **end, char **res) sz++; } if (quote) { - vshError(ctl, FALSE, _("missing \"")); + vshError(ctl, FALSE, "%s", _("missing \"")); return VSH_TK_ERROR; } if (tkstr == NULL || *tkstr == '\0' || p == NULL) @@ -6216,7 +6216,7 @@ vshConnectionUsability(vshControl * ctl, virConnectPtr conn, int showerror) */ if (!conn) { if (showerror) - vshError(ctl, FALSE, _("no valid connection")); + vshError(ctl, FALSE, "%s", _("no valid connection")); return FALSE; } return TRUE; @@ -6366,7 +6366,7 @@ vshInit(vshControl * ctl) * such as "help". */ if (!ctl->conn) { - vshError(ctl, FALSE, _("failed to connect to the hypervisor")); + vshError(ctl, FALSE, "%s", _("failed to connect to the hypervisor")); return FALSE; } @@ -6397,18 +6397,20 @@ vshOpenLogFile(vshControl *ctl) case ENOENT: break; default: - vshError(ctl, TRUE, _("failed to get the log file information")); + vshError(ctl, TRUE, "%s", + _("failed to get the log file information")); break; } } else { if (!S_ISREG(st.st_mode)) { - vshError(ctl, TRUE, _("the log path is not a file")); + vshError(ctl, TRUE, "%s", _("the log path is not a file")); } } /* log file open */ if ((ctl->log_fd = open(ctl->logfile, LOGFILE_FLAGS, FILE_MODE)) < 0) { - vshError(ctl, TRUE, _("failed to open the log file. check the log file path")); + vshError(ctl, TRUE, "%s", + _("failed to open the log file. check the log file path")); } } @@ -6476,7 +6478,7 @@ vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, va_list /* write log */ if (write(ctl->log_fd, msg_buf, strlen(msg_buf)) == -1) { vshCloseLogFile(ctl); - vshError(ctl, FALSE, _("failed to write the log file")); + vshError(ctl, FALSE, "%s", _("failed to write the log file")); } } @@ -6704,7 +6706,7 @@ vshUsage(vshControl * ctl, const char *cmdname) " %-15s %s\n", cmd->name, N_(vshCmddefGetInfo(cmd, "help"))); - fprintf(stdout, + fprintf(stdout, "%s", _("\n (specify help <command> for details about the command)\n\n")); return; } @@ -6891,7 +6893,7 @@ main(int argc, char **argv) vshPrint(ctl, _("Welcome to %s, the virtualization interactive terminal.\n\n"), progname); - vshPrint(ctl, + vshPrint(ctl, "%s", _("Type: 'help' for help with commands\n" " 'quit' to quit\n\n")); } -- 1.5.4.rc1.11.gd2f82 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list