avoid many format string warnings

Building with --disable-nls exposed many new warnings like these:
virsh.c:4952: warning: format not a string literal and no format ...
util.c:163: warning: format not a string literal and no format arguments
All but one of the following changes add a "%s" argument before
the offending _(...) argument.

This was the only manual change:
* src/lxc_driver.c (lxcVersion): Use %s and strerror(errno)
rather than %m, to avoid a warning from gcc -Wformat-security.

Add "%s" before each warned about format-string-with-no-%-directive:
* src/domain_conf.c (virDomainHostdevSubsysUsbDefParseXML)
(virDomainDefParseString, virDomainDefParseFile):
* src/hash.c (virGetConnect, __virGetDomain, virReleaseDomain)
(__virGetNetwork, virReleaseNetwork, __virGetStoragePool)
(virReleaseStoragePool, __virGetStorageVol, virReleaseStorageVol):
* src/lxc_container.c (lxcContainerChild):
* src/lxc_driver.c (lxcDomainDefine, lxcDomainUndefine)
(lxcDomainGetInfo, lxcGetOSType, lxcDomainDumpXML)
(lxcSetupInterfaces, lxcDomainStart, lxcDomainCreateAndStart)
(lxcVersion, lxcGetSchedulerParameters):
* src/network_conf.c (virNetworkDefParseString)
(virNetworkDefParseFile):
* src/openvz_conf.c (openvzReadNetworkConf, openvzLoadDomains):
* src/openvz_driver.c (openvzDomainDefineCmd)
(openvzDomainGetInfo, openvzDomainDumpXML, openvzDomainShutdown)
(openvzDomainReboot, ADD_ARG_LIT, openvzDomainDefineXML)
(openvzDomainCreateXML, openvzDomainCreate, openvzDomainUndefine)
(openvzDomainSetAutostart, openvzDomainGetAutostart)
(openvzDomainSetVcpus):
* src/qemu_driver.c (qemudDomainBlockPeek, qemudDomainMemoryPeek):
* src/remote_internal.c (remoteDomainBlockPeek)
(remoteDomainMemoryPeek, remoteAuthPolkit):
* src/sexpr.c (sexpr_new, _string2sexpr):
* src/storage_backend_disk.c (virStorageBackendDiskMakeDataVol)
(virStorageBackendDiskCreateVol):
* src/storage_backend_fs.c
(virStorageBackendFileSystemNetFindPoolSources):
* src/storage_backend_logical.c (virStorageBackendLogicalFindLVs)
(virStorageBackendLogicalFindPoolSources):
* src/test.c (testOpenDefault, testOpenFromFile, testOpen)
(testGetDomainInfo, testDomainRestore)
(testNodeGetCellsFreeMemory):
* src/util.c (virExec):
* src/virsh.c (cmdAttachDevice, cmdDetachDevice)
(cmdAttachInterface, cmdDetachInterface, cmdAttachDisk)
(cmdDetachDisk, cmdEdit):
* src/xend_internal.c (do_connect, wr_sync, xend_op_ext)
(urlencode, xenDaemonDomainCreateXML)
(xenDaemonDomainLookupByName_ids, xenDaemonDomainLookupByID)
(xenDaemonParseSxprOS, xend_parse_sexp_desc_char)
(xenDaemonParseSxprChar, xenDaemonParseSxprDisks)
(xenDaemonParseSxpr, sexpr_to_xend_topology, sexpr_to_domain)
(xenDaemonDomainFetch, xenDaemonDomainGetAutostart)
(xenDaemonDomainSetAutostart, xenDaemonDomainMigratePerform)
(xenDaemonDomainDefineXML, xenDaemonGetSchedulerType)
(xenDaemonGetSchedulerParameters)
(xenDaemonSetSchedulerParameters, xenDaemonDomainBlockPeek)
(xenDaemonFormatSxprChr, virDomainXMLDevID):
* src/xm_internal.c (xenXMConfigCacheRefresh, xenXMDomainPinVcpu)
(xenXMDomainCreate, xenXMDomainDefineXML)
(xenXMDomainAttachDevice, xenXMDomainDetachDevice):
* src/xml.c (virXPathString, virXPathNumber, virXPathLong)
(virXPathULong, virXPathBoolean, virXPathNode, virXPathNodeSet):
* src/xs_internal.c (xenStoreOpen):
This commit is contained in:
Jim Meyering 2008-10-13 16:46:28 +00:00
parent 72523d7bc2
commit fd52c6ff67
21 changed files with 296 additions and 226 deletions

View File

@ -1,3 +1,73 @@
Mon Oct 13 18:45:43 CEST 2008 Jim Meyering <meyering@redhat.com>
avoid many format string warnings
Building with --disable-nls exposed many new warnings like these:
virsh.c:4952: warning: format not a string literal and no format ...
util.c:163: warning: format not a string literal and no format arguments
All but one of the following changes add a "%s" argument before
the offending _(...) argument.
This was the only manual change:
* src/lxc_driver.c (lxcVersion): Use %s and strerror(errno)
rather than %m, to avoid a warning from gcc -Wformat-security.
Add "%s" before each warned about format-string-with-no-%-directive:
* src/domain_conf.c (virDomainHostdevSubsysUsbDefParseXML)
(virDomainDefParseString, virDomainDefParseFile):
* src/hash.c (virGetConnect, __virGetDomain, virReleaseDomain)
(__virGetNetwork, virReleaseNetwork, __virGetStoragePool)
(virReleaseStoragePool, __virGetStorageVol, virReleaseStorageVol):
* src/lxc_container.c (lxcContainerChild):
* src/lxc_driver.c (lxcDomainDefine, lxcDomainUndefine)
(lxcDomainGetInfo, lxcGetOSType, lxcDomainDumpXML)
(lxcSetupInterfaces, lxcDomainStart, lxcDomainCreateAndStart)
(lxcVersion, lxcGetSchedulerParameters):
* src/network_conf.c (virNetworkDefParseString)
(virNetworkDefParseFile):
* src/openvz_conf.c (openvzReadNetworkConf, openvzLoadDomains):
* src/openvz_driver.c (openvzDomainDefineCmd)
(openvzDomainGetInfo, openvzDomainDumpXML, openvzDomainShutdown)
(openvzDomainReboot, ADD_ARG_LIT, openvzDomainDefineXML)
(openvzDomainCreateXML, openvzDomainCreate, openvzDomainUndefine)
(openvzDomainSetAutostart, openvzDomainGetAutostart)
(openvzDomainSetVcpus):
* src/qemu_driver.c (qemudDomainBlockPeek, qemudDomainMemoryPeek):
* src/remote_internal.c (remoteDomainBlockPeek)
(remoteDomainMemoryPeek, remoteAuthPolkit):
* src/sexpr.c (sexpr_new, _string2sexpr):
* src/storage_backend_disk.c (virStorageBackendDiskMakeDataVol)
(virStorageBackendDiskCreateVol):
* src/storage_backend_fs.c
(virStorageBackendFileSystemNetFindPoolSources):
* src/storage_backend_logical.c (virStorageBackendLogicalFindLVs)
(virStorageBackendLogicalFindPoolSources):
* src/test.c (testOpenDefault, testOpenFromFile, testOpen)
(testGetDomainInfo, testDomainRestore)
(testNodeGetCellsFreeMemory):
* src/util.c (virExec):
* src/virsh.c (cmdAttachDevice, cmdDetachDevice)
(cmdAttachInterface, cmdDetachInterface, cmdAttachDisk)
(cmdDetachDisk, cmdEdit):
* src/xend_internal.c (do_connect, wr_sync, xend_op_ext)
(urlencode, xenDaemonDomainCreateXML)
(xenDaemonDomainLookupByName_ids, xenDaemonDomainLookupByID)
(xenDaemonParseSxprOS, xend_parse_sexp_desc_char)
(xenDaemonParseSxprChar, xenDaemonParseSxprDisks)
(xenDaemonParseSxpr, sexpr_to_xend_topology, sexpr_to_domain)
(xenDaemonDomainFetch, xenDaemonDomainGetAutostart)
(xenDaemonDomainSetAutostart, xenDaemonDomainMigratePerform)
(xenDaemonDomainDefineXML, xenDaemonGetSchedulerType)
(xenDaemonGetSchedulerParameters)
(xenDaemonSetSchedulerParameters, xenDaemonDomainBlockPeek)
(xenDaemonFormatSxprChr, virDomainXMLDevID):
* src/xm_internal.c (xenXMConfigCacheRefresh, xenXMDomainPinVcpu)
(xenXMDomainCreate, xenXMDomainDefineXML)
(xenXMDomainAttachDevice, xenXMDomainDetachDevice):
* src/xml.c (virXPathString, virXPathNumber, virXPathLong)
(virXPathULong, virXPathBoolean, virXPathNode, virXPathNodeSet):
* src/xs_internal.c (xenStoreOpen):
Mon Oct 13 16:24:00 BST 2008 Richard W.M. Jones <rjones@redhat.com> Mon Oct 13 16:24:00 BST 2008 Richard W.M. Jones <rjones@redhat.com>
Documentation for NIC model selection. Documentation for NIC model selection.

View File

@ -1523,13 +1523,13 @@ virDomainHostdevSubsysUsbDefParseXML(virConnectPtr conn,
if (def->source.subsys.usb.vendor == 0 && if (def->source.subsys.usb.vendor == 0 &&
def->source.subsys.usb.product != 0) { def->source.subsys.usb.product != 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("missing vendor")); "%s", _("missing vendor"));
goto out; goto out;
} }
if (def->source.subsys.usb.vendor != 0 && if (def->source.subsys.usb.vendor != 0 &&
def->source.subsys.usb.product == 0) { def->source.subsys.usb.product == 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("missing product")); "%s", _("missing product"));
goto out; goto out;
} }
@ -2244,7 +2244,7 @@ virDomainDefPtr virDomainDefParseString(virConnectPtr conn,
if (!xml) { if (!xml) {
if (conn && conn->err.code == VIR_ERR_NONE) if (conn && conn->err.code == VIR_ERR_NONE)
virDomainReportError(conn, VIR_ERR_XML_ERROR, virDomainReportError(conn, VIR_ERR_XML_ERROR,
_("failed to parse xml document")); "%s", _("failed to parse xml document"));
goto cleanup; goto cleanup;
} }
@ -2285,7 +2285,7 @@ virDomainDefPtr virDomainDefParseFile(virConnectPtr conn,
if (!xml) { if (!xml) {
if (conn && conn->err.code == VIR_ERR_NONE) if (conn && conn->err.code == VIR_ERR_NONE)
virDomainReportError(conn, VIR_ERR_XML_ERROR, virDomainReportError(conn, VIR_ERR_XML_ERROR,
_("failed to parse xml document")); "%s", _("failed to parse xml document"));
goto cleanup; goto cleanup;
} }

View File

@ -667,7 +667,7 @@ virGetConnect(void) {
virConnectPtr ret; virConnectPtr ret;
if (VIR_ALLOC(ret) < 0) { if (VIR_ALLOC(ret) < 0) {
virHashError(NULL, VIR_ERR_NO_MEMORY, _("allocating connection")); virHashError(NULL, VIR_ERR_NO_MEMORY, "%s", _("allocating connection"));
goto failed; goto failed;
} }
ret->magic = VIR_CONNECT_MAGIC; ret->magic = VIR_CONNECT_MAGIC;
@ -801,12 +801,12 @@ __virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid)
/* TODO check the UUID */ /* TODO check the UUID */
if (ret == NULL) { if (ret == NULL) {
if (VIR_ALLOC(ret) < 0) { if (VIR_ALLOC(ret) < 0) {
virHashError(conn, VIR_ERR_NO_MEMORY, _("allocating domain")); virHashError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocating domain"));
goto error; goto error;
} }
ret->name = strdup(name); ret->name = strdup(name);
if (ret->name == NULL) { if (ret->name == NULL) {
virHashError(conn, VIR_ERR_NO_MEMORY, _("allocating domain")); virHashError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocating domain"));
goto error; goto error;
} }
ret->magic = VIR_DOMAIN_MAGIC; ret->magic = VIR_DOMAIN_MAGIC;
@ -817,7 +817,7 @@ __virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid)
if (virHashAddEntry(conn->domains, name, ret) < 0) { if (virHashAddEntry(conn->domains, name, ret) < 0) {
virHashError(conn, VIR_ERR_INTERNAL_ERROR, virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("failed to add domain to connection hash table")); "%s", _("failed to add domain to connection hash table"));
goto error; goto error;
} }
conn->refs++; conn->refs++;
@ -858,7 +858,7 @@ virReleaseDomain(virDomainPtr domain) {
/* TODO search by UUID first as they are better differenciators */ /* TODO search by UUID first as they are better differenciators */
if (virHashRemoveEntry(conn->domains, domain->name, NULL) < 0) if (virHashRemoveEntry(conn->domains, domain->name, NULL) < 0)
virHashError(conn, VIR_ERR_INTERNAL_ERROR, virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("domain missing from connection hash table")); "%s", _("domain missing from connection hash table"));
if (conn->err.dom == domain) if (conn->err.dom == domain)
conn->err.dom = NULL; conn->err.dom = NULL;
@ -941,12 +941,12 @@ __virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid)
/* TODO check the UUID */ /* TODO check the UUID */
if (ret == NULL) { if (ret == NULL) {
if (VIR_ALLOC(ret) < 0) { if (VIR_ALLOC(ret) < 0) {
virHashError(conn, VIR_ERR_NO_MEMORY, _("allocating network")); virHashError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocating network"));
goto error; goto error;
} }
ret->name = strdup(name); ret->name = strdup(name);
if (ret->name == NULL) { if (ret->name == NULL) {
virHashError(conn, VIR_ERR_NO_MEMORY, _("allocating network")); virHashError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocating network"));
goto error; goto error;
} }
ret->magic = VIR_NETWORK_MAGIC; ret->magic = VIR_NETWORK_MAGIC;
@ -956,7 +956,7 @@ __virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid)
if (virHashAddEntry(conn->networks, name, ret) < 0) { if (virHashAddEntry(conn->networks, name, ret) < 0) {
virHashError(conn, VIR_ERR_INTERNAL_ERROR, virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("failed to add network to connection hash table")); "%s", _("failed to add network to connection hash table"));
goto error; goto error;
} }
conn->refs++; conn->refs++;
@ -994,7 +994,7 @@ virReleaseNetwork(virNetworkPtr network) {
/* TODO search by UUID first as they are better differenciators */ /* TODO search by UUID first as they are better differenciators */
if (virHashRemoveEntry(conn->networks, network->name, NULL) < 0) if (virHashRemoveEntry(conn->networks, network->name, NULL) < 0)
virHashError(conn, VIR_ERR_INTERNAL_ERROR, virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("network missing from connection hash table")); "%s", _("network missing from connection hash table"));
if (conn->err.net == network) if (conn->err.net == network)
conn->err.net = NULL; conn->err.net = NULL;
@ -1078,12 +1078,12 @@ __virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *u
/* TODO check the UUID */ /* TODO check the UUID */
if (ret == NULL) { if (ret == NULL) {
if (VIR_ALLOC(ret) < 0) { if (VIR_ALLOC(ret) < 0) {
virHashError(conn, VIR_ERR_NO_MEMORY, _("allocating storage pool")); virHashError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocating storage pool"));
goto error; goto error;
} }
ret->name = strdup(name); ret->name = strdup(name);
if (ret->name == NULL) { if (ret->name == NULL) {
virHashError(conn, VIR_ERR_NO_MEMORY, _("allocating storage pool")); virHashError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocating storage pool"));
goto error; goto error;
} }
ret->magic = VIR_STORAGE_POOL_MAGIC; ret->magic = VIR_STORAGE_POOL_MAGIC;
@ -1093,7 +1093,7 @@ __virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *u
if (virHashAddEntry(conn->storagePools, name, ret) < 0) { if (virHashAddEntry(conn->storagePools, name, ret) < 0) {
virHashError(conn, VIR_ERR_INTERNAL_ERROR, virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("failed to add storage pool to connection hash table")); "%s", _("failed to add storage pool to connection hash table"));
goto error; goto error;
} }
conn->refs++; conn->refs++;
@ -1132,7 +1132,7 @@ virReleaseStoragePool(virStoragePoolPtr pool) {
/* TODO search by UUID first as they are better differenciators */ /* TODO search by UUID first as they are better differenciators */
if (virHashRemoveEntry(conn->storagePools, pool->name, NULL) < 0) if (virHashRemoveEntry(conn->storagePools, pool->name, NULL) < 0)
virHashError(conn, VIR_ERR_INTERNAL_ERROR, virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("pool missing from connection hash table")); "%s", _("pool missing from connection hash table"));
pool->magic = -1; pool->magic = -1;
VIR_FREE(pool->name); VIR_FREE(pool->name);
@ -1209,17 +1209,17 @@ __virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const
ret = (virStorageVolPtr) virHashLookup(conn->storageVols, key); ret = (virStorageVolPtr) virHashLookup(conn->storageVols, key);
if (ret == NULL) { if (ret == NULL) {
if (VIR_ALLOC(ret) < 0) { if (VIR_ALLOC(ret) < 0) {
virHashError(conn, VIR_ERR_NO_MEMORY, _("allocating storage vol")); virHashError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocating storage vol"));
goto error; goto error;
} }
ret->pool = strdup(pool); ret->pool = strdup(pool);
if (ret->pool == NULL) { if (ret->pool == NULL) {
virHashError(conn, VIR_ERR_NO_MEMORY, _("allocating storage vol")); virHashError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocating storage vol"));
goto error; goto error;
} }
ret->name = strdup(name); ret->name = strdup(name);
if (ret->name == NULL) { if (ret->name == NULL) {
virHashError(conn, VIR_ERR_NO_MEMORY, _("allocating storage vol")); virHashError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocating storage vol"));
goto error; goto error;
} }
strncpy(ret->key, key, sizeof(ret->key)-1); strncpy(ret->key, key, sizeof(ret->key)-1);
@ -1229,7 +1229,7 @@ __virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const
if (virHashAddEntry(conn->storageVols, key, ret) < 0) { if (virHashAddEntry(conn->storageVols, key, ret) < 0) {
virHashError(conn, VIR_ERR_INTERNAL_ERROR, virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("failed to add storage vol to connection hash table")); "%s", _("failed to add storage vol to connection hash table"));
goto error; goto error;
} }
conn->refs++; conn->refs++;
@ -1269,7 +1269,7 @@ virReleaseStorageVol(virStorageVolPtr vol) {
/* TODO search by UUID first as they are better differenciators */ /* TODO search by UUID first as they are better differenciators */
if (virHashRemoveEntry(conn->storageVols, vol->key, NULL) < 0) if (virHashRemoveEntry(conn->storageVols, vol->key, NULL) < 0)
virHashError(conn, VIR_ERR_INTERNAL_ERROR, virHashError(conn, VIR_ERR_INTERNAL_ERROR,
_("vol missing from connection hash table")); "%s", _("vol missing from connection hash table"));
vol->magic = -1; vol->magic = -1;
VIR_FREE(vol->name); VIR_FREE(vol->name);

View File

@ -547,7 +547,7 @@ static int lxcContainerChild( void *data )
if (NULL == vmDef) { if (NULL == vmDef) {
lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("lxcChild() passed invalid vm definition")); "%s", _("lxcChild() passed invalid vm definition"));
return -1; return -1;
} }

View File

@ -230,7 +230,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
if ((def->nets != NULL) && !(driver->have_netns)) { if ((def->nets != NULL) && !(driver->have_netns)) {
lxcError(conn, NULL, VIR_ERR_NO_SUPPORT, lxcError(conn, NULL, VIR_ERR_NO_SUPPORT,
_("System lacks NETNS support")); "%s", _("System lacks NETNS support"));
virDomainDefFree(def); virDomainDefFree(def);
return NULL; return NULL;
} }
@ -263,13 +263,13 @@ static int lxcDomainUndefine(virDomainPtr dom)
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
if (virDomainIsActive(vm)) { if (virDomainIsActive(vm)) {
lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR, lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR,
_("cannot delete active domain")); "%s", _("cannot delete active domain"));
return -1; return -1;
} }
@ -298,7 +298,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
@ -324,7 +324,7 @@ static char *lxcGetOSType(virDomainPtr dom)
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return NULL; return NULL;
} }
@ -339,7 +339,7 @@ static char *lxcDomainDumpXML(virDomainPtr dom,
if (!vm) { if (!vm) {
lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN, lxcError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return NULL; return NULL;
} }
@ -458,7 +458,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
DEBUG("bridge: %s", bridge); DEBUG("bridge: %s", bridge);
if (NULL == bridge) { if (NULL == bridge) {
lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to get bridge for interface")); "%s", _("failed to get bridge for interface"));
goto error_exit; goto error_exit;
} }
@ -482,7 +482,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
if (NULL == def->nets[i]->ifname) { if (NULL == def->nets[i]->ifname) {
lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to allocate veth names")); "%s", _("failed to allocate veth names"));
goto error_exit; goto error_exit;
} }
@ -861,7 +861,7 @@ static int lxcDomainStart(virDomainPtr dom)
if ((vm->def->nets != NULL) && !(driver->have_netns)) { if ((vm->def->nets != NULL) && !(driver->have_netns)) {
lxcError(conn, NULL, VIR_ERR_NO_SUPPORT, lxcError(conn, NULL, VIR_ERR_NO_SUPPORT,
_("System lacks NETNS support")); "%s", _("System lacks NETNS support"));
goto cleanup; goto cleanup;
} }
@ -896,7 +896,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
if ((def->nets != NULL) && !(driver->have_netns)) { if ((def->nets != NULL) && !(driver->have_netns)) {
virDomainDefFree(def); virDomainDefFree(def);
lxcError(conn, NULL, VIR_ERR_NO_SUPPORT, lxcError(conn, NULL, VIR_ERR_NO_SUPPORT,
_("System lacks NETNS support")); "%s", _("System lacks NETNS support"));
goto return_point; goto return_point;
} }
@ -1113,7 +1113,7 @@ static int lxcVersion(virConnectPtr conn, unsigned long *version)
if (uname(&ver) != 0) { if (uname(&ver) != 0) {
lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR, lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
_("uname(): %m")); _("uname(): %s"), strerror(errno));
return -1; return -1;
} }
@ -1193,7 +1193,7 @@ static int lxcGetSchedulerParameters(virDomainPtr _domain,
if ((*nparams) != 1) { if ((*nparams) != 1) {
lxcError(NULL, _domain, VIR_ERR_INVALID_ARG, lxcError(NULL, _domain, VIR_ERR_INVALID_ARG,
_("Invalid parameter count")); "%s", _("Invalid parameter count"));
return -1; return -1;
} }

View File

@ -452,7 +452,7 @@ virNetworkDefPtr virNetworkDefParseString(virConnectPtr conn,
if (!xml) { if (!xml) {
if (conn && conn->err.code == VIR_ERR_NONE) if (conn && conn->err.code == VIR_ERR_NONE)
virNetworkReportError(conn, VIR_ERR_XML_ERROR, virNetworkReportError(conn, VIR_ERR_XML_ERROR,
_("failed to parse xml document")); "%s", _("failed to parse xml document"));
goto cleanup; goto cleanup;
} }
@ -492,7 +492,7 @@ virNetworkDefPtr virNetworkDefParseFile(virConnectPtr conn,
if (!xml) { if (!xml) {
if (conn && conn->err.code == VIR_ERR_NONE) if (conn && conn->err.code == VIR_ERR_NONE)
virNetworkReportError(conn, VIR_ERR_XML_ERROR, virNetworkReportError(conn, VIR_ERR_XML_ERROR,
_("failed to parse xml document")); "%s", _("failed to parse xml document"));
goto cleanup; goto cleanup;
} }

View File

@ -222,7 +222,7 @@ openvzReadNetworkConf(virConnectPtr conn,
len = next - p; len = next - p;
if (len > 16) { if (len > 16) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Too long network device name")); "%s", _("Too long network device name"));
goto error; goto error;
} }
@ -239,14 +239,14 @@ openvzReadNetworkConf(virConnectPtr conn,
len = next - p; len = next - p;
if (len != 17) { //should be 17 if (len != 17) { //should be 17
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Wrong length MAC address")); "%s", _("Wrong length MAC address"));
goto error; goto error;
} }
strncpy(cpy_temp, p, len); strncpy(cpy_temp, p, len);
cpy_temp[len] = '\0'; cpy_temp[len] = '\0';
if (openvzParseMac(cpy_temp, net->mac)<0) { if (openvzParseMac(cpy_temp, net->mac)<0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Wrong MAC address")); "%s", _("Wrong MAC address"));
goto error; goto error;
} }
} else if (STRPREFIX(p, "host_mac=")) { } else if (STRPREFIX(p, "host_mac=")) {
@ -299,7 +299,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {
return -1; return -1;
if ((fp = popen(VZLIST " -a -ovpsid,status -H 2>/dev/null", "r")) == NULL) { if ((fp = popen(VZLIST " -a -ovpsid,status -H 2>/dev/null", "r")) == NULL) {
openvzError(NULL, VIR_ERR_INTERNAL_ERROR, _("popen failed")); openvzError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("popen failed"));
return -1; return -1;
} }
@ -309,7 +309,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {
break; break;
openvzError(NULL, VIR_ERR_INTERNAL_ERROR, openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
_("Failed to parse vzlist output")); "%s", _("Failed to parse vzlist output"));
goto cleanup; goto cleanup;
} }
@ -335,7 +335,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {
if (ret == -1) { if (ret == -1) {
openvzError(NULL, VIR_ERR_INTERNAL_ERROR, openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
_("UUID in config file malformed")); "%s", _("UUID in config file malformed"));
goto cleanup; goto cleanup;
} }

View File

@ -92,7 +92,7 @@ static int openvzDomainDefineCmd(virConnectPtr conn,
if (vmdef == NULL){ if (vmdef == NULL){
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Container is not defined")); "%s", _("Container is not defined"));
return -1; return -1;
} }
@ -235,7 +235,7 @@ static int openvzDomainGetInfo(virDomainPtr dom,
if (!vm) { if (!vm) {
openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN, openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
@ -264,7 +264,7 @@ static char *openvzDomainDumpXML(virDomainPtr dom, int flags) {
if (!vm) { if (!vm) {
openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN, openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return NULL; return NULL;
} }
@ -280,13 +280,13 @@ static int openvzDomainShutdown(virDomainPtr dom) {
if (!vm) { if (!vm) {
openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN, openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
if (vm->state != VIR_DOMAIN_RUNNING) { if (vm->state != VIR_DOMAIN_RUNNING) {
openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR, openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
_("domain is not in running state")); "%s", _("domain is not in running state"));
return -1; return -1;
} }
@ -307,13 +307,13 @@ static int openvzDomainReboot(virDomainPtr dom,
if (!vm) { if (!vm) {
openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN, openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
if (vm->state != VIR_DOMAIN_RUNNING) { if (vm->state != VIR_DOMAIN_RUNNING) {
openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR, openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
_("domain is not in running state")); "%s", _("domain is not in running state"));
return -1; return -1;
} }
@ -344,7 +344,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
return 0; return 0;
if (vpsid == NULL) { if (vpsid == NULL) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Container ID is not specified")); "%s", _("Container ID is not specified"));
return -1; return -1;
} }
@ -444,7 +444,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
if (openvzDomainDefineCmd(conn, prog, OPENVZ_MAX_ARG, vmdef) < 0) { if (openvzDomainDefineCmd(conn, prog, OPENVZ_MAX_ARG, vmdef) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Error creating command for container")); "%s", _("Error creating command for container"));
goto exit; goto exit;
} }
@ -458,7 +458,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
if (openvzSetDefinedUUID(strtoI(vmdef->name), vmdef->uuid) < 0) { if (openvzSetDefinedUUID(strtoI(vmdef->name), vmdef->uuid) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not set UUID")); "%s", _("Could not set UUID"));
goto exit; goto exit;
} }
@ -469,7 +469,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
for (i = 0 ; i < vmdef->nnets ; i++) { for (i = 0 ; i < vmdef->nnets ; i++) {
if (openvzDomainSetNetwork(conn, vmdef->name, vmdef->nets[i]) < 0) { if (openvzDomainSetNetwork(conn, vmdef->name, vmdef->nets[i]) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not configure network")); "%s", _("Could not configure network"));
goto exit; goto exit;
} }
} }
@ -477,7 +477,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
if (vmdef->vcpus > 0) { if (vmdef->vcpus > 0) {
if (openvzDomainSetVcpus(dom, vmdef->vcpus) < 0) { if (openvzDomainSetVcpus(dom, vmdef->vcpus) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not set number of virtual cpu")); "%s", _("Could not set number of virtual cpu"));
goto exit; goto exit;
} }
} }
@ -524,7 +524,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
if (openvzDomainDefineCmd(conn, progcreate, OPENVZ_MAX_ARG, vmdef) < 0) { if (openvzDomainDefineCmd(conn, progcreate, OPENVZ_MAX_ARG, vmdef) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Error creating command for container")); "%s", _("Error creating command for container"));
goto exit; goto exit;
} }
@ -536,14 +536,14 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
if (openvzSetDefinedUUID(strtoI(vmdef->name), vmdef->uuid) < 0) { if (openvzSetDefinedUUID(strtoI(vmdef->name), vmdef->uuid) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not set UUID")); "%s", _("Could not set UUID"));
goto exit; goto exit;
} }
for (i = 0 ; i < vmdef->nnets ; i++) { for (i = 0 ; i < vmdef->nnets ; i++) {
if (openvzDomainSetNetwork(conn, vmdef->name, vmdef->nets[i]) < 0) { if (openvzDomainSetNetwork(conn, vmdef->name, vmdef->nets[i]) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not configure network")); "%s", _("Could not configure network"));
goto exit; goto exit;
} }
} }
@ -567,7 +567,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
if (vmdef->vcpus > 0) { if (vmdef->vcpus > 0) {
if (openvzDomainSetVcpus(dom, vmdef->vcpus) < 0) { if (openvzDomainSetVcpus(dom, vmdef->vcpus) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not set number of virtual cpu")); "%s", _("Could not set number of virtual cpu"));
goto exit; goto exit;
} }
} }
@ -586,13 +586,13 @@ openvzDomainCreate(virDomainPtr dom)
if (!vm) { if (!vm) {
openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN, openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching id")); "%s", _("no domain with matching id"));
return -1; return -1;
} }
if (vm->state != VIR_DOMAIN_SHUTOFF) { if (vm->state != VIR_DOMAIN_SHUTOFF) {
openvzError(dom->conn, VIR_ERR_OPERATION_DENIED, openvzError(dom->conn, VIR_ERR_OPERATION_DENIED,
_("domain is not in shutoff state")); "%s", _("domain is not in shutoff state"));
return -1; return -1;
} }
@ -618,12 +618,12 @@ openvzDomainUndefine(virDomainPtr dom)
const char *prog[] = { VZCTL, "--quiet", "destroy", vm ? vm->def->name : NULL, NULL }; const char *prog[] = { VZCTL, "--quiet", "destroy", vm ? vm->def->name : NULL, NULL };
if (!vm) { if (!vm) {
openvzError(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid")); openvzError(conn, VIR_ERR_INVALID_DOMAIN, "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
if (virDomainIsActive(vm)) { if (virDomainIsActive(vm)) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("cannot delete active domain")); openvzError(conn, VIR_ERR_INTERNAL_ERROR, "%s", _("cannot delete active domain"));
return -1; return -1;
} }
@ -649,7 +649,7 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
"--save", NULL }; "--save", NULL };
if (!vm) { if (!vm) {
openvzError(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid")); openvzError(conn, VIR_ERR_INVALID_DOMAIN, "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
@ -670,12 +670,12 @@ openvzDomainGetAutostart(virDomainPtr dom, int *autostart)
char value[1024]; char value[1024];
if (!vm) { if (!vm) {
openvzError(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid")); openvzError(conn, VIR_ERR_INVALID_DOMAIN, "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
if (openvzReadConfigParam(strtoI(vm->def->name), "ONBOOT", value, sizeof(value)) < 0) { if (openvzReadConfigParam(strtoI(vm->def->name), "ONBOOT", value, sizeof(value)) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("Could not read container config")); openvzError(conn, VIR_ERR_INTERNAL_ERROR, "%s", _("Could not read container config"));
return -1; return -1;
} }
@ -711,13 +711,13 @@ static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
if (!vm) { if (!vm) {
openvzError(conn, VIR_ERR_INVALID_DOMAIN, openvzError(conn, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
if (nvcpus <= 0) { if (nvcpus <= 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("VCPUs should be >= 1")); "%s", _("VCPUs should be >= 1"));
return -1; return -1;
} }

View File

@ -2941,13 +2941,13 @@ qemudDomainBlockPeek (virDomainPtr dom,
if (!vm) { if (!vm) {
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid")); "%s", _("no domain with matching uuid"));
return -1; return -1;
} }
if (!path || path[0] == '\0') { if (!path || path[0] == '\0') {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG, qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
_("NULL or empty path")); "%s", _("NULL or empty path"));
return -1; return -1;
} }
@ -2958,7 +2958,7 @@ qemudDomainBlockPeek (virDomainPtr dom,
goto found; goto found;
} }
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG, qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
_("invalid path")); "%s", _("invalid path"));
return -1; return -1;
found: found:
@ -3001,7 +3001,7 @@ qemudDomainMemoryPeek (virDomainPtr dom,
if (flags != VIR_MEMORY_VIRTUAL) { if (flags != VIR_MEMORY_VIRTUAL) {
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG, qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
_("QEMU driver only supports virtual memory addrs")); "%s", _("QEMU driver only supports virtual memory addrs"));
return -1; return -1;
} }

View File

@ -2364,7 +2364,7 @@ remoteDomainBlockPeek (virDomainPtr domain,
if (ret.buffer.buffer_len != size) { if (ret.buffer.buffer_len != size) {
errorf (domain->conn, VIR_ERR_RPC, errorf (domain->conn, VIR_ERR_RPC,
_("returned buffer is not same size as requested")); "%s", _("returned buffer is not same size as requested"));
free (ret.buffer.buffer_val); free (ret.buffer.buffer_val);
return -1; return -1;
} }
@ -2408,7 +2408,7 @@ remoteDomainMemoryPeek (virDomainPtr domain,
if (ret.buffer.buffer_len != size) { if (ret.buffer.buffer_len != size) {
errorf (domain->conn, VIR_ERR_RPC, errorf (domain->conn, VIR_ERR_RPC,
_("returned buffer is not same size as requested")); "%s", _("returned buffer is not same size as requested"));
free (ret.buffer.buffer_val); free (ret.buffer.buffer_val);
return -1; return -1;
} }
@ -4267,7 +4267,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) { if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("Failed to collect auth credentials")); "%s", _("Failed to collect auth credentials"));
return -1; return -1;
} }
} else { } else {

View File

@ -40,7 +40,7 @@ sexpr_new(void)
struct sexpr *ret; struct sexpr *ret;
if (VIR_ALLOC(ret) < 0) { if (VIR_ALLOC(ret) < 0) {
virSexprError(VIR_ERR_NO_MEMORY, _("failed to allocate a node")); virSexprError(VIR_ERR_NO_MEMORY, "%s", _("failed to allocate a node"));
return (NULL); return (NULL);
} }
ret->kind = SEXPR_NIL; ret->kind = SEXPR_NIL;
@ -344,7 +344,7 @@ _string2sexpr(const char *buffer, size_t * end)
ret->u.value = strndup(start, ptr - start); ret->u.value = strndup(start, ptr - start);
if (ret->u.value == NULL) { if (ret->u.value == NULL) {
virSexprError(VIR_ERR_NO_MEMORY, virSexprError(VIR_ERR_NO_MEMORY,
_("failed to copy a string")); "%s", _("failed to copy a string"));
goto error; goto error;
} }
@ -361,7 +361,7 @@ _string2sexpr(const char *buffer, size_t * end)
ret->u.value = strndup(start, ptr - start); ret->u.value = strndup(start, ptr - start);
if (ret->u.value == NULL) { if (ret->u.value == NULL) {
virSexprError(VIR_ERR_NO_MEMORY, virSexprError(VIR_ERR_NO_MEMORY,
_("failed to copy a string")); "%s", _("failed to copy a string"));
goto error; goto error;
} }
} }

View File

@ -178,13 +178,13 @@ virStorageBackendDiskMakeDataVol(virConnectPtr conn,
if (vol == NULL) { if (vol == NULL) {
if (VIR_ALLOC(vol) < 0) { if (VIR_ALLOC(vol) < 0) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, _("volume")); virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("volume"));
return -1; return -1;
} }
if (VIR_REALLOC_N(pool->volumes.objs, if (VIR_REALLOC_N(pool->volumes.objs,
pool->volumes.count+1) < 0) { pool->volumes.count+1) < 0) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, _("volume")); virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("volume"));
virStorageVolDefFree(vol); virStorageVolDefFree(vol);
return -1; return -1;
} }
@ -195,14 +195,14 @@ virStorageBackendDiskMakeDataVol(virConnectPtr conn,
*/ */
tmp = strrchr(groups[0], '/'); tmp = strrchr(groups[0], '/');
if ((vol->name = strdup(tmp ? tmp + 1 : groups[0])) == NULL) { if ((vol->name = strdup(tmp ? tmp + 1 : groups[0])) == NULL) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, _("volume")); virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("volume"));
return -1; return -1;
} }
} }
if (vol->target.path == NULL) { if (vol->target.path == NULL) {
if ((devpath = strdup(groups[0])) == NULL) { if ((devpath = strdup(groups[0])) == NULL) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, _("volume")); virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("volume"));
return -1; return -1;
} }
@ -224,7 +224,7 @@ virStorageBackendDiskMakeDataVol(virConnectPtr conn,
if (vol->key == NULL) { if (vol->key == NULL) {
/* XXX base off a unique key of the underlying disk */ /* XXX base off a unique key of the underlying disk */
if ((vol->key = strdup(vol->target.path)) == NULL) { if ((vol->key = strdup(vol->target.path)) == NULL) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, _("volume")); virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("volume"));
return -1; return -1;
} }
} }
@ -232,7 +232,7 @@ virStorageBackendDiskMakeDataVol(virConnectPtr conn,
if (vol->source.extents == NULL) { if (vol->source.extents == NULL) {
if (VIR_ALLOC(vol->source.extents) < 0) { if (VIR_ALLOC(vol->source.extents) < 0) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, virStorageReportError(conn, VIR_ERR_NO_MEMORY,
_("volume extents")); "%s", _("volume extents"));
return -1; return -1;
} }
vol->source.nextent = 1; vol->source.nextent = 1;
@ -240,20 +240,20 @@ virStorageBackendDiskMakeDataVol(virConnectPtr conn,
if (virStrToLong_ull(groups[3], NULL, 10, if (virStrToLong_ull(groups[3], NULL, 10,
&vol->source.extents[0].start) < 0) { &vol->source.extents[0].start) < 0) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot parse device start location")); "%s", _("cannot parse device start location"));
return -1; return -1;
} }
if (virStrToLong_ull(groups[4], NULL, 10, if (virStrToLong_ull(groups[4], NULL, 10,
&vol->source.extents[0].end) < 0) { &vol->source.extents[0].end) < 0) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot parse device end location")); "%s", _("cannot parse device end location"));
return -1; return -1;
} }
if ((vol->source.extents[0].path = if ((vol->source.extents[0].path =
strdup(pool->def->source.devices[0].path)) == NULL) { strdup(pool->def->source.devices[0].path)) == NULL) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, _("extents")); virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("extents"));
return -1; return -1;
} }
} }
@ -460,7 +460,7 @@ virStorageBackendDiskCreateVol(virConnectPtr conn,
} }
if (smallestExtent == -1) { if (smallestExtent == -1) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("no large enough free extent")); "%s", _("no large enough free extent"));
return -1; return -1;
} }
startOffset = dev->freeExtents[smallestExtent].start; startOffset = dev->freeExtents[smallestExtent].start;

View File

@ -556,7 +556,7 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn,
retval = virStringListJoin(state.list, SOURCES_START_TAG, SOURCES_END_TAG, "\n"); retval = virStringListJoin(state.list, SOURCES_START_TAG, SOURCES_END_TAG, "\n");
if (retval == NULL) { if (retval == NULL) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, _("retval")); virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("retval"));
goto cleanup; goto cleanup;
} }

View File

@ -233,7 +233,7 @@ virStorageBackendLogicalFindLVs(virConnectPtr conn,
vol, vol,
&exitstatus) < 0) { &exitstatus) < 0) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("lvs command failed")); "%s", _("lvs command failed"));
return -1; return -1;
} }
@ -321,7 +321,7 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn,
retval = virStringListJoin(descs, SOURCES_START_TAG, SOURCES_END_TAG, "\n"); retval = virStringListJoin(descs, SOURCES_START_TAG, SOURCES_END_TAG, "\n");
if (retval == NULL) { if (retval == NULL) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, _("retval")); virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("retval"));
goto cleanup; goto cleanup;
} }

View File

@ -213,7 +213,7 @@ static int testOpenDefault(virConnectPtr conn) {
conn->privateData = privconn; conn->privateData = privconn;
if (gettimeofday(&tv, NULL) < 0) { if (gettimeofday(&tv, NULL) < 0) {
testError(NULL, VIR_ERR_INTERNAL_ERROR, _("getting time of day")); testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("getting time of day"));
goto error; goto error;
} }
@ -311,14 +311,14 @@ static int testOpenFromFile(virConnectPtr conn,
goto error; goto error;
if ((fd = open(file, O_RDONLY)) < 0) { if ((fd = open(file, O_RDONLY)) < 0) {
testError(NULL, VIR_ERR_INTERNAL_ERROR, _("loading host definition file")); testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("loading host definition file"));
goto error; goto error;
} }
if (!(xml = xmlReadFd(fd, file, NULL, if (!(xml = xmlReadFd(fd, file, NULL,
XML_PARSE_NOENT | XML_PARSE_NONET | XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING))) { XML_PARSE_NOERROR | XML_PARSE_NOWARNING))) {
testError(NULL, VIR_ERR_INTERNAL_ERROR, _("host")); testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("host"));
goto error; goto error;
} }
close(fd); close(fd);
@ -326,13 +326,13 @@ static int testOpenFromFile(virConnectPtr conn,
root = xmlDocGetRootElement(xml); root = xmlDocGetRootElement(xml);
if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "node"))) { if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "node"))) {
testError(NULL, VIR_ERR_XML_ERROR, _("node")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node"));
goto error; goto error;
} }
ctxt = xmlXPathNewContext(xml); ctxt = xmlXPathNewContext(xml);
if (ctxt == NULL) { if (ctxt == NULL) {
testError(NULL, VIR_ERR_INTERNAL_ERROR, _("creating xpath context")); testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("creating xpath context"));
goto error; goto error;
} }
@ -347,7 +347,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) { if (ret == 0) {
nodeInfo->nodes = l; nodeInfo->nodes = l;
} else if (ret == -2) { } else if (ret == -2) {
testError(NULL, VIR_ERR_XML_ERROR, _("node cpu numa nodes")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu numa nodes"));
goto error; goto error;
} }
@ -355,7 +355,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) { if (ret == 0) {
nodeInfo->sockets = l; nodeInfo->sockets = l;
} else if (ret == -2) { } else if (ret == -2) {
testError(NULL, VIR_ERR_XML_ERROR, _("node cpu sockets")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu sockets"));
goto error; goto error;
} }
@ -363,7 +363,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) { if (ret == 0) {
nodeInfo->cores = l; nodeInfo->cores = l;
} else if (ret == -2) { } else if (ret == -2) {
testError(NULL, VIR_ERR_XML_ERROR, _("node cpu cores")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu cores"));
goto error; goto error;
} }
@ -371,7 +371,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) { if (ret == 0) {
nodeInfo->threads = l; nodeInfo->threads = l;
} else if (ret == -2) { } else if (ret == -2) {
testError(NULL, VIR_ERR_XML_ERROR, _("node cpu threads")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu threads"));
goto error; goto error;
} }
@ -382,14 +382,14 @@ static int testOpenFromFile(virConnectPtr conn,
nodeInfo->cpus = l; nodeInfo->cpus = l;
} }
} else if (ret == -2) { } else if (ret == -2) {
testError(NULL, VIR_ERR_XML_ERROR, _("node active cpu")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node active cpu"));
goto error; goto error;
} }
ret = virXPathLong(conn, "string(/node/cpu/mhz[1])", ctxt, &l); ret = virXPathLong(conn, "string(/node/cpu/mhz[1])", ctxt, &l);
if (ret == 0) { if (ret == 0) {
nodeInfo->mhz = l; nodeInfo->mhz = l;
} else if (ret == -2) { } else if (ret == -2) {
testError(NULL, VIR_ERR_XML_ERROR, _("node cpu mhz")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu mhz"));
goto error; goto error;
} }
@ -404,13 +404,13 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) { if (ret == 0) {
nodeInfo->memory = l; nodeInfo->memory = l;
} else if (ret == -2) { } else if (ret == -2) {
testError(NULL, VIR_ERR_XML_ERROR, _("node memory")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node memory"));
goto error; goto error;
} }
ret = virXPathNodeSet(conn, "/node/domain", ctxt, &domains); ret = virXPathNodeSet(conn, "/node/domain", ctxt, &domains);
if (ret < 0) { if (ret < 0) {
testError(NULL, VIR_ERR_XML_ERROR, _("node domain list")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node domain list"));
goto error; goto error;
} }
@ -421,7 +421,7 @@ static int testOpenFromFile(virConnectPtr conn,
char *absFile = testBuildFilename(file, relFile); char *absFile = testBuildFilename(file, relFile);
VIR_FREE(relFile); VIR_FREE(relFile);
if (!absFile) { if (!absFile) {
testError(NULL, VIR_ERR_INTERNAL_ERROR, _("resolving domain filename")); testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("resolving domain filename"));
goto error; goto error;
} }
def = virDomainDefParseFile(conn, privconn->caps, absFile); def = virDomainDefParseFile(conn, privconn->caps, absFile);
@ -447,7 +447,7 @@ static int testOpenFromFile(virConnectPtr conn,
ret = virXPathNodeSet(conn, "/node/network", ctxt, &networks); ret = virXPathNodeSet(conn, "/node/network", ctxt, &networks);
if (ret < 0) { if (ret < 0) {
testError(NULL, VIR_ERR_XML_ERROR, _("node network list")); testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node network list"));
goto error; goto error;
} }
for (i = 0 ; i < ret ; i++) { for (i = 0 ; i < ret ; i++) {
@ -457,7 +457,7 @@ static int testOpenFromFile(virConnectPtr conn,
char *absFile = testBuildFilename(file, relFile); char *absFile = testBuildFilename(file, relFile);
VIR_FREE(relFile); VIR_FREE(relFile);
if (!absFile) { if (!absFile) {
testError(NULL, VIR_ERR_INTERNAL_ERROR, _("resolving network filename")); testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("resolving network filename"));
goto error; goto error;
} }
@ -525,7 +525,7 @@ static int testOpen(virConnectPtr conn,
|| uri->path[0] == '\0' || uri->path[0] == '\0'
|| (uri->path[0] == '/' && uri->path[1] == '\0')) { || (uri->path[0] == '/' && uri->path[1] == '\0')) {
testError (NULL, VIR_ERR_INVALID_ARG, testError (NULL, VIR_ERR_INVALID_ARG,
_("testOpen: supply a path or use test:///default")); "%s", _("testOpen: supply a path or use test:///default"));
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
} }
@ -837,7 +837,7 @@ static int testGetDomainInfo (virDomainPtr domain,
if (gettimeofday(&tv, NULL) < 0) { if (gettimeofday(&tv, NULL) < 0) {
testError(domain->conn, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("getting time of day")); "%s", _("getting time of day"));
return (-1); return (-1);
} }
@ -925,30 +925,30 @@ static int testDomainRestore(virConnectPtr conn,
if ((fd = open(path, O_RDONLY)) < 0) { if ((fd = open(path, O_RDONLY)) < 0) {
testError(conn, VIR_ERR_INTERNAL_ERROR, testError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot read domain image")); "%s", _("cannot read domain image"));
return (-1); return (-1);
} }
if (read(fd, magic, sizeof(magic)) != sizeof(magic)) { if (read(fd, magic, sizeof(magic)) != sizeof(magic)) {
testError(conn, VIR_ERR_INTERNAL_ERROR, testError(conn, VIR_ERR_INTERNAL_ERROR,
_("incomplete save header")); "%s", _("incomplete save header"));
close(fd); close(fd);
return (-1); return (-1);
} }
if (memcmp(magic, TEST_SAVE_MAGIC, sizeof(magic))) { if (memcmp(magic, TEST_SAVE_MAGIC, sizeof(magic))) {
testError(conn, VIR_ERR_INTERNAL_ERROR, testError(conn, VIR_ERR_INTERNAL_ERROR,
_("mismatched header magic")); "%s", _("mismatched header magic"));
close(fd); close(fd);
return (-1); return (-1);
} }
if (read(fd, (char*)&len, sizeof(len)) != sizeof(len)) { if (read(fd, (char*)&len, sizeof(len)) != sizeof(len)) {
testError(conn, VIR_ERR_INTERNAL_ERROR, testError(conn, VIR_ERR_INTERNAL_ERROR,
_("failed to read metadata length")); "%s", _("failed to read metadata length"));
close(fd); close(fd);
return (-1); return (-1);
} }
if (len < 1 || len > 8192) { if (len < 1 || len > 8192) {
testError(conn, VIR_ERR_INTERNAL_ERROR, testError(conn, VIR_ERR_INTERNAL_ERROR,
_("length of metadata out of range")); "%s", _("length of metadata out of range"));
close(fd); close(fd);
return (-1); return (-1);
} }
@ -959,7 +959,7 @@ static int testDomainRestore(virConnectPtr conn,
} }
if (read(fd, xml, len) != len) { if (read(fd, xml, len) != len) {
testError(conn, VIR_ERR_INTERNAL_ERROR, testError(conn, VIR_ERR_INTERNAL_ERROR,
_("incomplete metdata")); "%s", _("incomplete metdata"));
close(fd); close(fd);
return (-1); return (-1);
} }
@ -1147,7 +1147,7 @@ static int testNodeGetCellsFreeMemory(virConnectPtr conn,
if (startCell > privconn->numCells) { if (startCell > privconn->numCells) {
testError(conn, VIR_ERR_INVALID_ARG, testError(conn, VIR_ERR_INVALID_ARG,
_("Range exceeds available cells")); "%s", _("Range exceeds available cells"));
return -1; return -1;
} }

View File

@ -155,13 +155,13 @@ virExec(virConnectPtr conn,
if ((flags & VIR_EXEC_NONBLOCK) && if ((flags & VIR_EXEC_NONBLOCK) &&
virSetNonBlock(pipeout[0]) == -1) { virSetNonBlock(pipeout[0]) == -1) {
ReportError(conn, VIR_ERR_INTERNAL_ERROR, ReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("Failed to set non-blocking file descriptor flag")); "%s", _("Failed to set non-blocking file descriptor flag"));
goto cleanup; goto cleanup;
} }
if (virSetCloseExec(pipeout[0]) == -1) { if (virSetCloseExec(pipeout[0]) == -1) {
ReportError(conn, VIR_ERR_INTERNAL_ERROR, ReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("Failed to set close-on-exec file descriptor flag")); "%s", _("Failed to set close-on-exec file descriptor flag"));
goto cleanup; goto cleanup;
} }
@ -186,13 +186,13 @@ virExec(virConnectPtr conn,
if ((flags & VIR_EXEC_NONBLOCK) && if ((flags & VIR_EXEC_NONBLOCK) &&
virSetNonBlock(pipeerr[0]) == -1) { virSetNonBlock(pipeerr[0]) == -1) {
ReportError(conn, VIR_ERR_INTERNAL_ERROR, ReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("Failed to set non-blocking file descriptor flag")); "%s", _("Failed to set non-blocking file descriptor flag"));
goto cleanup; goto cleanup;
} }
if (virSetCloseExec(pipeerr[0]) == -1) { if (virSetCloseExec(pipeerr[0]) == -1) {
ReportError(conn, VIR_ERR_INTERNAL_ERROR, ReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("Failed to set close-on-exec file descriptor flag")); "%s", _("Failed to set close-on-exec file descriptor flag"));
goto cleanup; goto cleanup;
} }

View File

@ -4660,7 +4660,7 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
virDomainFree(dom); virDomainFree(dom);
return FALSE; return FALSE;
} else { } else {
vshPrint(ctl, _("Device attached successfully\n")); vshPrint(ctl, "%s", _("Device attached successfully\n"));
} }
virDomainFree(dom); virDomainFree(dom);
@ -4719,7 +4719,7 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
virDomainFree(dom); virDomainFree(dom);
return FALSE; return FALSE;
} else { } else {
vshPrint(ctl, _("Device detached successfully\n")); vshPrint(ctl, "%s", _("Device detached successfully\n"));
} }
virDomainFree(dom); virDomainFree(dom);
@ -4831,7 +4831,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
if (virDomainAttachDevice(dom, buf)) { if (virDomainAttachDevice(dom, buf)) {
goto cleanup; goto cleanup;
} else { } else {
vshPrint(ctl, _("Interface attached successfully\n")); vshPrint(ctl, "%s", _("Interface attached successfully\n"));
} }
ret = TRUE; ret = TRUE;
@ -4949,7 +4949,7 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
if (ret != 0) if (ret != 0)
ret = FALSE; ret = FALSE;
else { else {
vshPrint(ctl, _("Interface detached successfully\n")); vshPrint(ctl, "%s", _("Interface detached successfully\n"));
ret = TRUE; ret = TRUE;
} }
@ -5118,7 +5118,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
if (virDomainAttachDevice(dom, buf)) if (virDomainAttachDevice(dom, buf))
goto cleanup; goto cleanup;
else else
vshPrint(ctl, _("Disk attached successfully\n")); vshPrint(ctl, "%s", _("Disk attached successfully\n"));
ret = TRUE; ret = TRUE;
@ -5227,7 +5227,7 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
if (ret != 0) if (ret != 0)
ret = FALSE; ret = FALSE;
else { else {
vshPrint(ctl, _("Disk detached successfully\n")); vshPrint(ctl, "%s", _("Disk detached successfully\n"));
ret = TRUE; ret = TRUE;
} }
@ -5433,7 +5433,7 @@ cmdEdit (vshControl *ctl, const vshCmd *cmd)
if (STRNEQ (doc, doc_reread)) { if (STRNEQ (doc, doc_reread)) {
vshError (ctl, FALSE, vshError (ctl, FALSE,
_("ERROR: the XML configuration was changed by another user")); "%s", _("ERROR: the XML configuration was changed by another user"));
goto cleanup; goto cleanup;
} }

View File

@ -130,7 +130,7 @@ do_connect(virConnectPtr xend)
s = socket(priv->type, SOCK_STREAM, 0); s = socket(priv->type, SOCK_STREAM, 0);
if (s == -1) { if (s == -1) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("failed to create a socket")); "%s", _("failed to create a socket"));
return -1; return -1;
} }
@ -152,7 +152,7 @@ do_connect(virConnectPtr xend)
*/ */
if (getuid() == 0) { if (getuid() == 0) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("failed to connect to xend")); "%s", _("failed to connect to xend"));
} }
} }
@ -199,10 +199,10 @@ wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int do_read)
if (len == -1) { if (len == -1) {
if (do_read) if (do_read)
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("failed to read from Xen Daemon")); "%s", _("failed to read from Xen Daemon"));
else else
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("failed to read from Xen Daemon")); "%s", _("failed to read from Xen Daemon"));
return (-1); return (-1);
} }
@ -529,7 +529,7 @@ xend_op_ext(virConnectPtr xend, const char *path, char *error,
} }
if (virBufferError(&buf)) { if (virBufferError(&buf)) {
virXendError(NULL, VIR_ERR_NO_MEMORY, _("allocate buffer")); virXendError(NULL, VIR_ERR_NO_MEMORY, "%s", _("allocate buffer"));
return -1; return -1;
} }
@ -709,7 +709,7 @@ urlencode(const char *string)
size_t i; size_t i;
if (VIR_ALLOC_N(buffer, len * 3 + 1) < 0) { if (VIR_ALLOC_N(buffer, len * 3 + 1) < 0) {
virXendError(NULL, VIR_ERR_NO_MEMORY, _("allocate new buffer")); virXendError(NULL, VIR_ERR_NO_MEMORY, "%s", _("allocate new buffer"));
return (NULL); return (NULL);
} }
ptr = buffer; ptr = buffer;
@ -963,7 +963,7 @@ xenDaemonDomainCreateXML(virConnectPtr xend, const char *sexpr)
if (ptr == NULL) { if (ptr == NULL) {
/* this should be caught at the interface but ... */ /* this should be caught at the interface but ... */
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("failed to urlencode the create S-Expr")); "%s", _("failed to urlencode the create S-Expr"));
return (-1); return (-1);
} }
@ -1004,18 +1004,18 @@ xenDaemonDomainLookupByName_ids(virConnectPtr xend, const char *domname,
value = sexpr_node(root, "domain/domid"); value = sexpr_node(root, "domain/domid");
if (value == NULL) { if (value == NULL) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing domid")); "%s", _("domain information incomplete, missing domid"));
goto error; goto error;
} }
ret = strtol(value, NULL, 0); ret = strtol(value, NULL, 0);
if ((ret == 0) && (value[0] != '0')) { if ((ret == 0) && (value[0] != '0')) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("domain information incorrect domid not numeric")); "%s", _("domain information incorrect domid not numeric"));
ret = -1; ret = -1;
} else if (uuid != NULL) { } else if (uuid != NULL) {
if (sexpr_uuid(uuid, root, "domain/uuid") < 0) { if (sexpr_uuid(uuid, root, "domain/uuid") < 0) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing uuid")); "%s", _("domain information incomplete, missing uuid"));
} }
} }
@ -1054,7 +1054,7 @@ xenDaemonDomainLookupByID(virConnectPtr xend,
name = sexpr_node(root, "domain/name"); name = sexpr_node(root, "domain/name");
if (name == NULL) { if (name == NULL) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing name")); "%s", _("domain information incomplete, missing name"));
goto error; goto error;
} }
if (domname) if (domname)
@ -1062,7 +1062,7 @@ xenDaemonDomainLookupByID(virConnectPtr xend,
if (sexpr_uuid(uuid, root, "domain/uuid") < 0) { if (sexpr_uuid(uuid, root, "domain/uuid") < 0) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing uuid")); "%s", _("domain information incomplete, missing uuid"));
goto error; goto error;
} }
@ -1143,7 +1143,7 @@ xenDaemonParseSxprOS(virConnectPtr xend,
if (def->os.loader == NULL) { if (def->os.loader == NULL) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing HVM loader")); "%s", _("domain information incomplete, missing HVM loader"));
return(-1); return(-1);
} }
} else { } else {
@ -1197,7 +1197,7 @@ xenDaemonParseSxprOS(virConnectPtr xend,
!def->os.kernel && !def->os.kernel &&
!def->os.bootloader) { !def->os.bootloader) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR, virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing kernel & bootloader")); "%s", _("domain information incomplete, missing kernel & bootloader"));
return -1; return -1;
} }
@ -1261,7 +1261,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
value += sizeof("unix:")-1; value += sizeof("unix:")-1;
} else { } else {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("Unknown char device type")); "%s", _("Unknown char device type"));
return -1; return -1;
} }
@ -1295,7 +1295,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
if (offset == NULL) { if (offset == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("malformed char device string")); "%s", _("malformed char device string"));
goto error; goto error;
} }
@ -1335,7 +1335,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
if (offset == NULL) { if (offset == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("malformed char device string")); "%s", _("malformed char device string"));
goto error; goto error;
} }
@ -1351,7 +1351,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
offset3 = strchr(offset2, ':'); offset3 = strchr(offset2, ':');
if (offset3 == NULL) { if (offset3 == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("malformed char device string")); "%s", _("malformed char device string"));
goto error; goto error;
} }
@ -1418,7 +1418,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
if (ret == -1) { if (ret == -1) {
no_memory: no_memory:
virXendError(conn, VIR_ERR_NO_MEMORY, virXendError(conn, VIR_ERR_NO_MEMORY,
_("no memory for char device config")); "%s", _("no memory for char device config"));
} }
error: error:
@ -1490,7 +1490,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
if (offset == NULL) { if (offset == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("malformed char device string")); "%s", _("malformed char device string"));
goto error; goto error;
} }
@ -1518,7 +1518,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
if (offset == NULL) { if (offset == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("malformed char device string")); "%s", _("malformed char device string"));
goto error; goto error;
} }
@ -1534,7 +1534,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
offset3 = strchr(offset2, ':'); offset3 = strchr(offset2, ':');
if (offset3 == NULL) { if (offset3 == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("malformed char device string")); "%s", _("malformed char device string"));
goto error; goto error;
} }
@ -1625,7 +1625,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
if (dst == NULL) { if (dst == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, vbd has no dev")); "%s", _("domain information incomplete, vbd has no dev"));
goto error; goto error;
} }
@ -1636,7 +1636,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
!hvm || !hvm ||
STRNEQ(offset, ":cdrom")) { STRNEQ(offset, ":cdrom")) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, vbd has no src")); "%s", _("domain information incomplete, vbd has no src"));
goto error; goto error;
} }
} }
@ -1645,7 +1645,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
offset = strchr(src, ':'); offset = strchr(src, ':');
if (!offset) { if (!offset) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot parse vbd filename, missing driver name")); "%s", _("cannot parse vbd filename, missing driver name"));
goto error; goto error;
} }
@ -1660,7 +1660,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
offset = strchr(src, ':'); offset = strchr(src, ':');
if (!offset) { if (!offset) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot parse vbd filename, missing driver type")); "%s", _("cannot parse vbd filename, missing driver type"));
goto error; goto error;
} }
@ -2143,7 +2143,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/domid"); tmp = sexpr_node(root, "domain/domid");
if (tmp == NULL && xendConfigVersion < 3) { /* Old XenD, domid was mandatory */ if (tmp == NULL && xendConfigVersion < 3) { /* Old XenD, domid was mandatory */
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing id")); "%s", _("domain information incomplete, missing id"));
goto error; goto error;
} }
def->virtType = VIR_DOMAIN_VIRT_XEN; def->virtType = VIR_DOMAIN_VIRT_XEN;
@ -2156,14 +2156,14 @@ xenDaemonParseSxpr(virConnectPtr conn,
goto no_memory; goto no_memory;
if (def->name == NULL) { if (def->name == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing name")); "%s", _("domain information incomplete, missing name"));
goto error; goto error;
} }
tmp = sexpr_node(root, "domain/uuid"); tmp = sexpr_node(root, "domain/uuid");
if (tmp == NULL) { if (tmp == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing name")); "%s", _("domain information incomplete, missing name"));
goto error; goto error;
} }
virUUIDParse(tmp, def->uuid); virUUIDParse(tmp, def->uuid);
@ -2553,7 +2553,7 @@ sexpr_to_xend_topology(virConnectPtr conn,
nodeToCpu = sexpr_node(root, "node/node_to_cpu"); nodeToCpu = sexpr_node(root, "node/node_to_cpu");
if (nodeToCpu == NULL) { if (nodeToCpu == NULL) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("failed to parse topology information")); "%s", _("failed to parse topology information"));
return -1; return -1;
} }
@ -2607,7 +2607,7 @@ sexpr_to_xend_topology(virConnectPtr conn,
return (0); return (0);
parse_error: parse_error:
virXendError(conn, VIR_ERR_XEN_CALL, _("topology syntax error")); virXendError(conn, VIR_ERR_XEN_CALL, "%s", _("topology syntax error"));
error: error:
VIR_FREE(cpuNums); VIR_FREE(cpuNums);
VIR_FREE(cpuset); VIR_FREE(cpuset);
@ -2617,7 +2617,7 @@ sexpr_to_xend_topology(virConnectPtr conn,
memory_error: memory_error:
VIR_FREE(cpuNums); VIR_FREE(cpuNums);
VIR_FREE(cpuset); VIR_FREE(cpuset);
virXendError(conn, VIR_ERR_NO_MEMORY, _("allocate buffer")); virXendError(conn, VIR_ERR_NO_MEMORY, "%s", _("allocate buffer"));
return (-1); return (-1);
} }
@ -2671,7 +2671,7 @@ sexpr_to_domain(virConnectPtr conn, const struct sexpr *root)
error: error:
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("failed to parse Xend domain information")); "%s", _("failed to parse Xend domain information"));
if (ret != NULL) if (ret != NULL)
virUnrefDomain(ret); virUnrefDomain(ret);
return(NULL); return(NULL);
@ -3153,7 +3153,7 @@ xenDaemonDomainFetch(virConnectPtr conn,
root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid); root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid);
if (root == NULL) { if (root == NULL) {
virXendError (conn, VIR_ERR_XEN_CALL, virXendError (conn, VIR_ERR_XEN_CALL,
_("xenDaemonDomainFetch failed to" "%s", _("xenDaemonDomainFetch failed to"
" find this domain")); " find this domain"));
return (NULL); return (NULL);
} }
@ -3980,7 +3980,7 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name); root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL) { if (root == NULL) {
virXendError (domain->conn, VIR_ERR_XEN_CALL, virXendError (domain->conn, VIR_ERR_XEN_CALL,
_("xenDaemonGetAutostart failed to find this domain")); "%s", _("xenDaemonGetAutostart failed to find this domain"));
return (-1); return (-1);
} }
@ -4021,7 +4021,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name); root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL) { if (root == NULL) {
virXendError (domain->conn, VIR_ERR_XEN_CALL, virXendError (domain->conn, VIR_ERR_XEN_CALL,
_("xenDaemonSetAutostart failed to find this domain")); "%s", _("xenDaemonSetAutostart failed to find this domain"));
return (-1); return (-1);
} }
@ -4029,7 +4029,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
if (autostr) { if (autostr) {
if (!STREQ(autostr, "ignore") && !STREQ(autostr, "start")) { if (!STREQ(autostr, "ignore") && !STREQ(autostr, "start")) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("unexpected value from on_xend_start")); "%s", _("unexpected value from on_xend_start"));
goto error; goto error;
} }
@ -4040,23 +4040,23 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
: strdup("ignore")); : strdup("ignore"));
if (!(autonode->u.s.car->u.value)) { if (!(autonode->u.s.car->u.value)) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("no memory")); "%s", _("no memory"));
goto error; goto error;
} }
if (sexpr2string(root, buf, sizeof(buf)) == 0) { if (sexpr2string(root, buf, sizeof(buf)) == 0) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("sexpr2string failed")); "%s", _("sexpr2string failed"));
goto error; goto error;
} }
if (xend_op(domain->conn, "", "op", "new", "config", buf, NULL) != 0) { if (xend_op(domain->conn, "", "op", "new", "config", buf, NULL) != 0) {
virXendError(domain->conn, VIR_ERR_XEN_CALL, virXendError(domain->conn, VIR_ERR_XEN_CALL,
_("Failed to redefine sexpr")); "%s", _("Failed to redefine sexpr"));
goto error; goto error;
} }
} else { } else {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("on_xend_start not present in sexpr")); "%s", _("on_xend_start not present in sexpr"));
goto error; goto error;
} }
@ -4124,7 +4124,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
/* Xen doesn't support renaming domains during migration. */ /* Xen doesn't support renaming domains during migration. */
if (dname) { if (dname) {
virXendError (conn, VIR_ERR_NO_SUPPORT, virXendError (conn, VIR_ERR_NO_SUPPORT,
_("xenDaemonDomainMigrate: Xen does not support" "%s", _("xenDaemonDomainMigrate: Xen does not support"
" renaming domains during migration")); " renaming domains during migration"));
return -1; return -1;
} }
@ -4134,7 +4134,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
*/ */
if (bandwidth) { if (bandwidth) {
virXendError (conn, VIR_ERR_NO_SUPPORT, virXendError (conn, VIR_ERR_NO_SUPPORT,
_("xenDaemonDomainMigrate: Xen does not support" "%s", _("xenDaemonDomainMigrate: Xen does not support"
" bandwidth limits during migration")); " bandwidth limits during migration"));
return -1; return -1;
} }
@ -4146,7 +4146,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
} }
if (flags != 0) { if (flags != 0) {
virXendError (conn, VIR_ERR_NO_SUPPORT, virXendError (conn, VIR_ERR_NO_SUPPORT,
_("xenDaemonDomainMigrate: unsupported flag")); "%s", _("xenDaemonDomainMigrate: unsupported flag"));
return -1; return -1;
} }
@ -4159,26 +4159,26 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
xmlURIPtr uriptr = xmlParseURI (uri); xmlURIPtr uriptr = xmlParseURI (uri);
if (!uriptr) { if (!uriptr) {
virXendError (conn, VIR_ERR_INVALID_ARG, virXendError (conn, VIR_ERR_INVALID_ARG,
_("xenDaemonDomainMigrate: invalid URI")); "%s", _("xenDaemonDomainMigrate: invalid URI"));
return -1; return -1;
} }
if (uriptr->scheme && STRCASENEQ (uriptr->scheme, "xenmigr")) { if (uriptr->scheme && STRCASENEQ (uriptr->scheme, "xenmigr")) {
virXendError (conn, VIR_ERR_INVALID_ARG, virXendError (conn, VIR_ERR_INVALID_ARG,
_("xenDaemonDomainMigrate: only xenmigr://" "%s", _("xenDaemonDomainMigrate: only xenmigr://"
" migrations are supported by Xen")); " migrations are supported by Xen"));
xmlFreeURI (uriptr); xmlFreeURI (uriptr);
return -1; return -1;
} }
if (!uriptr->server) { if (!uriptr->server) {
virXendError (conn, VIR_ERR_INVALID_ARG, virXendError (conn, VIR_ERR_INVALID_ARG,
_("xenDaemonDomainMigrate: a hostname must be" "%s", _("xenDaemonDomainMigrate: a hostname must be"
" specified in the URI")); " specified in the URI"));
xmlFreeURI (uriptr); xmlFreeURI (uriptr);
return -1; return -1;
} }
hostname = strdup (uriptr->server); hostname = strdup (uriptr->server);
if (!hostname) { if (!hostname) {
virXendError (conn, VIR_ERR_NO_MEMORY, _("strdup failed")); virXendError (conn, VIR_ERR_NO_MEMORY, "%s", _("strdup failed"));
xmlFreeURI (uriptr); xmlFreeURI (uriptr);
return -1; return -1;
} }
@ -4191,7 +4191,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
if (sscanf (p+1, "%d", &port_nr) != 1) { if (sscanf (p+1, "%d", &port_nr) != 1) {
virXendError (conn, VIR_ERR_INVALID_ARG, virXendError (conn, VIR_ERR_INVALID_ARG,
_("xenDaemonDomainMigrate: invalid port number")); "%s", _("xenDaemonDomainMigrate: invalid port number"));
return -1; return -1;
} }
snprintf (port, sizeof port, "%d", port_nr); snprintf (port, sizeof port, "%d", port_nr);
@ -4200,7 +4200,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
n = p - uri; /* n = Length of hostname in bytes. */ n = p - uri; /* n = Length of hostname in bytes. */
hostname = strdup (uri); hostname = strdup (uri);
if (!hostname) { if (!hostname) {
virXendError (conn, VIR_ERR_NO_MEMORY, _("strdup failed")); virXendError (conn, VIR_ERR_NO_MEMORY, "%s", _("strdup failed"));
return -1; return -1;
} }
hostname[n] = '\0'; hostname[n] = '\0';
@ -4208,7 +4208,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
else { /* "hostname" (or IP address) */ else { /* "hostname" (or IP address) */
hostname = strdup (uri); hostname = strdup (uri);
if (!hostname) { if (!hostname) {
virXendError (conn, VIR_ERR_NO_MEMORY, _("strdup failed")); virXendError (conn, VIR_ERR_NO_MEMORY, "%s", _("strdup failed"));
return -1; return -1;
} }
} }
@ -4244,13 +4244,13 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
if (!(def = virDomainDefParseString(conn, priv->caps, xmlDesc))) { if (!(def = virDomainDefParseString(conn, priv->caps, xmlDesc))) {
virXendError(conn, VIR_ERR_XML_ERROR, virXendError(conn, VIR_ERR_XML_ERROR,
_("failed to parse domain description")); "%s", _("failed to parse domain description"));
return (NULL); return (NULL);
} }
if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) { if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) {
virXendError(conn, VIR_ERR_XML_ERROR, virXendError(conn, VIR_ERR_XML_ERROR,
_("failed to build sexpr")); "%s", _("failed to build sexpr"));
goto error; goto error;
} }
@ -4416,7 +4416,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
priv = (xenUnifiedPrivatePtr) domain->conn->privateData; priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < 4) { if (priv->xendConfigVersion < 4) {
virXendError (domain->conn, VIR_ERR_NO_SUPPORT, virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
_("unsupported in xendConfigVersion < 4")); "%s", _("unsupported in xendConfigVersion < 4"));
return NULL; return NULL;
} }
@ -4428,25 +4428,25 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
ret = sexpr_node(root, "node/xen_scheduler"); ret = sexpr_node(root, "node/xen_scheduler");
if (ret == NULL){ if (ret == NULL){
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("node information incomplete, missing scheduler name")); "%s", _("node information incomplete, missing scheduler name"));
goto error; goto error;
} }
if (STREQ (ret, "credit")) { if (STREQ (ret, "credit")) {
schedulertype = strdup("credit"); schedulertype = strdup("credit");
if (schedulertype == NULL){ if (schedulertype == NULL){
virXendError(domain->conn, VIR_ERR_SYSTEM_ERROR, _("strdup failed")); virXendError(domain->conn, VIR_ERR_SYSTEM_ERROR, "%s", _("strdup failed"));
goto error; goto error;
} }
*nparams = XEN_SCHED_CRED_NPARAM; *nparams = XEN_SCHED_CRED_NPARAM;
} else if (STREQ (ret, "sedf")) { } else if (STREQ (ret, "sedf")) {
schedulertype = strdup("sedf"); schedulertype = strdup("sedf");
if (schedulertype == NULL){ if (schedulertype == NULL){
virXendError(domain->conn, VIR_ERR_SYSTEM_ERROR, _("strdup failed")); virXendError(domain->conn, VIR_ERR_SYSTEM_ERROR, "%s", _("strdup failed"));
goto error; goto error;
} }
*nparams = XEN_SCHED_SEDF_NPARAM; *nparams = XEN_SCHED_SEDF_NPARAM;
} else { } else {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, _("Unknown scheduler")); virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
goto error; goto error;
} }
@ -4492,7 +4492,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
priv = (xenUnifiedPrivatePtr) domain->conn->privateData; priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < 4) { if (priv->xendConfigVersion < 4) {
virXendError (domain->conn, VIR_ERR_NO_SUPPORT, virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
_("unsupported in xendConfigVersion < 4")); "%s", _("unsupported in xendConfigVersion < 4"));
return (-1); return (-1);
} }
@ -4505,7 +4505,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam); sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
if (sched_type == NULL) { if (sched_type == NULL) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("Failed to get a scheduler name")); "%s", _("Failed to get a scheduler name"));
goto error; goto error;
} }
@ -4518,12 +4518,12 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
/* get cpu_weight/cpu_cap from xend/domain */ /* get cpu_weight/cpu_cap from xend/domain */
if (sexpr_node(root, "domain/cpu_weight") == NULL) { if (sexpr_node(root, "domain/cpu_weight") == NULL) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing cpu_weight")); "%s", _("domain information incomplete, missing cpu_weight"));
goto error; goto error;
} }
if (sexpr_node(root, "domain/cpu_cap") == NULL) { if (sexpr_node(root, "domain/cpu_cap") == NULL) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing cpu_cap")); "%s", _("domain information incomplete, missing cpu_cap"));
goto error; goto error;
} }
@ -4540,7 +4540,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
ret = 0; ret = 0;
break; break;
default: default:
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, _("Unknown scheduler")); virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
goto error; goto error;
} }
@ -4582,7 +4582,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
priv = (xenUnifiedPrivatePtr) domain->conn->privateData; priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < 4) { if (priv->xendConfigVersion < 4) {
virXendError (domain->conn, VIR_ERR_NO_SUPPORT, virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
_("unsupported in xendConfigVersion < 4")); "%s", _("unsupported in xendConfigVersion < 4"));
return (-1); return (-1);
} }
@ -4595,7 +4595,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam); sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
if (sched_type == NULL) { if (sched_type == NULL) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("Failed to get a scheduler name")); "%s", _("Failed to get a scheduler name"));
goto error; goto error;
} }
@ -4631,7 +4631,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
weight = sexpr_node(root, "domain/cpu_weight"); weight = sexpr_node(root, "domain/cpu_weight");
if (weight == NULL) { if (weight == NULL) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing cpu_weight")); "%s", _("domain information incomplete, missing cpu_weight"));
goto error; goto error;
} }
snprintf(buf_weight, sizeof(buf_weight), "%s", weight); snprintf(buf_weight, sizeof(buf_weight), "%s", weight);
@ -4640,7 +4640,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
cap = sexpr_node(root, "domain/cpu_cap"); cap = sexpr_node(root, "domain/cpu_cap");
if (cap == NULL) { if (cap == NULL) {
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing cpu_cap")); "%s", _("domain information incomplete, missing cpu_cap"));
goto error; goto error;
} }
snprintf(buf_cap, sizeof(buf_cap), "%s", cap); snprintf(buf_cap, sizeof(buf_cap), "%s", cap);
@ -4652,7 +4652,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
break; break;
} }
default: default:
virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, _("Unknown scheduler")); virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
goto error; goto error;
} }
@ -4698,7 +4698,7 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
else { else {
/* This call always fails for dom0. */ /* This call always fails for dom0. */
virXendError (domain->conn, VIR_ERR_NO_SUPPORT, virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
_("domainBlockPeek is not supported for dom0")); "%s", _("domainBlockPeek is not supported for dom0"));
return -1; return -1;
} }
@ -4911,7 +4911,7 @@ xenDaemonFormatSxprChr(virConnectPtr conn,
if (!type) { if (!type) {
virXendError(conn, VIR_ERR_INTERNAL_ERROR, virXendError(conn, VIR_ERR_INTERNAL_ERROR,
_("unexpected chr device type")); "%s", _("unexpected chr device type"));
return -1; return -1;
} }
@ -5488,7 +5488,7 @@ virDomainXMLDevID(virDomainPtr domain,
ref[ref_len - 1] = '\0'; ref[ref_len - 1] = '\0';
} else { } else {
virXendError(NULL, VIR_ERR_NO_SUPPORT, virXendError(NULL, VIR_ERR_NO_SUPPORT,
_("hotplug of device type not supported")); "%s", _("hotplug of device type not supported"));
return -1; return -1;
} }

View File

@ -487,7 +487,7 @@ static int xenXMConfigCacheRefresh (virConnectPtr conn) {
virDomainDefFree(entry->def); virDomainDefFree(entry->def);
VIR_FREE(entry); VIR_FREE(entry);
xenXMError (conn, VIR_ERR_INTERNAL_ERROR, xenXMError (conn, VIR_ERR_INTERNAL_ERROR,
_("xenXMConfigCacheRefresh: virHashAddEntry")); "%s", _("xenXMConfigCacheRefresh: virHashAddEntry"));
goto cleanup; goto cleanup;
} }
} }
@ -1419,22 +1419,22 @@ int xenXMDomainPinVcpu(virDomainPtr domain,
} }
if (domain->conn->flags & VIR_CONNECT_RO) { if (domain->conn->flags & VIR_CONNECT_RO) {
xenXMError (domain->conn, VIR_ERR_INVALID_ARG, xenXMError (domain->conn, VIR_ERR_INVALID_ARG,
_("read only connection")); "%s", _("read only connection"));
return -1; return -1;
} }
if (domain->id != -1) { if (domain->id != -1) {
xenXMError (domain->conn, VIR_ERR_INVALID_ARG, xenXMError (domain->conn, VIR_ERR_INVALID_ARG,
_("not inactive domain")); "%s", _("not inactive domain"));
return -1; return -1;
} }
if (!(filename = virHashLookup(nameConfigMap, domain->name))) { if (!(filename = virHashLookup(nameConfigMap, domain->name))) {
xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, _("virHashLookup")); xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("virHashLookup"));
return -1; return -1;
} }
if (!(entry = virHashLookup(configCache, filename))) { if (!(entry = virHashLookup(configCache, filename))) {
xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR,
_("can't retrieve config file for domain")); "%s", _("can't retrieve config file for domain"));
return -1; return -1;
} }
@ -1452,14 +1452,14 @@ int xenXMDomainPinVcpu(virDomainPtr domain,
} }
if (virBufferError(&mapbuf)) { if (virBufferError(&mapbuf)) {
xenXMError(domain->conn, VIR_ERR_NO_MEMORY, _("allocate buffer")); xenXMError(domain->conn, VIR_ERR_NO_MEMORY, "%s", _("allocate buffer"));
return -1; return -1;
} }
mapstr = virBufferContentAndReset(&mapbuf); mapstr = virBufferContentAndReset(&mapbuf);
if (VIR_ALLOC_N(cpuset, maxcpu) < 0) { if (VIR_ALLOC_N(cpuset, maxcpu) < 0) {
xenXMError(domain->conn, VIR_ERR_NO_MEMORY, _("allocate buffer")); xenXMError(domain->conn, VIR_ERR_NO_MEMORY, "%s", _("allocate buffer"));
goto cleanup; goto cleanup;
} }
if (virDomainCpuSetParse(domain->conn, if (virDomainCpuSetParse(domain->conn,
@ -1594,7 +1594,7 @@ int xenXMDomainCreate(virDomainPtr domain) {
if (!(sexpr = xenDaemonFormatSxpr(domain->conn, entry->def, priv->xendConfigVersion))) { if (!(sexpr = xenDaemonFormatSxpr(domain->conn, entry->def, priv->xendConfigVersion))) {
xenXMError(domain->conn, VIR_ERR_XML_ERROR, xenXMError(domain->conn, VIR_ERR_XML_ERROR,
_("failed to build sexpr")); "%s", _("failed to build sexpr"));
return (-1); return (-1);
} }
@ -2216,13 +2216,13 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
if (!(oldfilename = (char *)virHashLookup(nameConfigMap, def->name))) { if (!(oldfilename = (char *)virHashLookup(nameConfigMap, def->name))) {
xenXMError(conn, VIR_ERR_INTERNAL_ERROR, xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
_("can't retrieve config filename for domain to overwrite")); "%s", _("can't retrieve config filename for domain to overwrite"));
goto error; goto error;
} }
if (!(entry = virHashLookup(configCache, oldfilename))) { if (!(entry = virHashLookup(configCache, oldfilename))) {
xenXMError(conn, VIR_ERR_INTERNAL_ERROR, xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
_("can't retrieve config entry for domain to overwrite")); "%s", _("can't retrieve config entry for domain to overwrite"));
goto error; goto error;
} }
@ -2233,14 +2233,14 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
/* Remove the name -> filename mapping */ /* Remove the name -> filename mapping */
if (virHashRemoveEntry(nameConfigMap, def->name, NULL) < 0) { if (virHashRemoveEntry(nameConfigMap, def->name, NULL) < 0) {
xenXMError(conn, VIR_ERR_INTERNAL_ERROR, xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
_("failed to remove old domain from config map")); "%s", _("failed to remove old domain from config map"));
goto error; goto error;
} }
/* Remove the config record itself */ /* Remove the config record itself */
if (virHashRemoveEntry(configCache, oldfilename, xenXMConfigFree) < 0) { if (virHashRemoveEntry(configCache, oldfilename, xenXMConfigFree) < 0) {
xenXMError(conn, VIR_ERR_INTERNAL_ERROR, xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
_("failed to remove old domain from config map")); "%s", _("failed to remove old domain from config map"));
goto error; goto error;
} }
@ -2249,7 +2249,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
if ((strlen(configDir) + 1 + strlen(def->name) + 1) > PATH_MAX) { if ((strlen(configDir) + 1 + strlen(def->name) + 1) > PATH_MAX) {
xenXMError(conn, VIR_ERR_INTERNAL_ERROR, xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
_("config file name is too long")); "%s", _("config file name is too long"));
goto error; goto error;
} }
@ -2261,13 +2261,13 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
goto error; goto error;
if (VIR_ALLOC(entry) < 0) { if (VIR_ALLOC(entry) < 0) {
xenXMError(conn, VIR_ERR_NO_MEMORY, _("config")); xenXMError(conn, VIR_ERR_NO_MEMORY, "%s", _("config"));
goto error; goto error;
} }
if ((entry->refreshedAt = time(NULL)) == ((time_t)-1)) { if ((entry->refreshedAt = time(NULL)) == ((time_t)-1)) {
xenXMError(conn, VIR_ERR_INTERNAL_ERROR, xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
_("unable to get current time")); "%s", _("unable to get current time"));
goto error; goto error;
} }
@ -2276,14 +2276,14 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
if (virHashAddEntry(configCache, filename, entry) < 0) { if (virHashAddEntry(configCache, filename, entry) < 0) {
xenXMError(conn, VIR_ERR_INTERNAL_ERROR, xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
_("unable to store config file handle")); "%s", _("unable to store config file handle"));
goto error; goto error;
} }
if (virHashAddEntry(nameConfigMap, def->name, entry->filename) < 0) { if (virHashAddEntry(nameConfigMap, def->name, entry->filename) < 0) {
virHashRemoveEntry(configCache, filename, NULL); virHashRemoveEntry(configCache, filename, NULL);
xenXMError(conn, VIR_ERR_INTERNAL_ERROR, xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
_("unable to store config file handle")); "%s", _("unable to store config file handle"));
goto error; goto error;
} }
@ -2471,7 +2471,7 @@ xenXMDomainAttachDevice(virDomainPtr domain, const char *xml) {
default: default:
xenXMError(domain->conn, VIR_ERR_XML_ERROR, xenXMError(domain->conn, VIR_ERR_XML_ERROR,
_("unknown device")); "%s", _("unknown device"));
goto cleanup; goto cleanup;
} }
@ -2586,7 +2586,7 @@ xenXMDomainDetachDevice(virDomainPtr domain, const char *xml) {
} }
default: default:
xenXMError(domain->conn, VIR_ERR_XML_ERROR, xenXMError(domain->conn, VIR_ERR_XML_ERROR,
_("unknown device")); "%s", _("unknown device"));
goto cleanup; goto cleanup;
} }

View File

@ -54,7 +54,7 @@ virXPathString(virConnectPtr conn,
if ((ctxt == NULL) || (xpath == NULL)) { if ((ctxt == NULL) || (xpath == NULL)) {
virXMLError(conn, VIR_ERR_INTERNAL_ERROR, virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
_("Invalid parameter to virXPathString()")); "%s", _("Invalid parameter to virXPathString()"));
return (NULL); return (NULL);
} }
relnode = ctxt->node; relnode = ctxt->node;
@ -67,7 +67,7 @@ virXPathString(virConnectPtr conn,
ret = strdup((char *) obj->stringval); ret = strdup((char *) obj->stringval);
xmlXPathFreeObject(obj); xmlXPathFreeObject(obj);
if (ret == NULL) { if (ret == NULL) {
virXMLError(conn, VIR_ERR_NO_MEMORY, _("strdup failed")); virXMLError(conn, VIR_ERR_NO_MEMORY, "%s", _("strdup failed"));
} }
ctxt->node = relnode; ctxt->node = relnode;
return (ret); return (ret);
@ -95,7 +95,7 @@ virXPathNumber(virConnectPtr conn,
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) { if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
virXMLError(conn, VIR_ERR_INTERNAL_ERROR, virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
_("Invalid parameter to virXPathNumber()")); "%s", _("Invalid parameter to virXPathNumber()"));
return (-1); return (-1);
} }
relnode = ctxt->node; relnode = ctxt->node;
@ -137,7 +137,7 @@ virXPathLong(virConnectPtr conn,
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) { if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
virXMLError(conn, VIR_ERR_INTERNAL_ERROR, virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
_("Invalid parameter to virXPathNumber()")); "%s", _("Invalid parameter to virXPathNumber()"));
return (-1); return (-1);
} }
relnode = ctxt->node; relnode = ctxt->node;
@ -192,7 +192,7 @@ virXPathULong(virConnectPtr conn,
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) { if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
virXMLError(conn, VIR_ERR_INTERNAL_ERROR, virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
_("Invalid parameter to virXPathNumber()")); "%s", _("Invalid parameter to virXPathNumber()"));
return (-1); return (-1);
} }
relnode = ctxt->node; relnode = ctxt->node;
@ -250,7 +250,7 @@ virXPathBoolean(virConnectPtr conn,
if ((ctxt == NULL) || (xpath == NULL)) { if ((ctxt == NULL) || (xpath == NULL)) {
virXMLError(conn, VIR_ERR_INTERNAL_ERROR, virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
_("Invalid parameter to virXPathBoolean()")); "%s", _("Invalid parameter to virXPathBoolean()"));
return (-1); return (-1);
} }
relnode = ctxt->node; relnode = ctxt->node;
@ -288,7 +288,7 @@ virXPathNode(virConnectPtr conn,
if ((ctxt == NULL) || (xpath == NULL)) { if ((ctxt == NULL) || (xpath == NULL)) {
virXMLError(conn, VIR_ERR_INTERNAL_ERROR, virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
_("Invalid parameter to virXPathNode()")); "%s", _("Invalid parameter to virXPathNode()"));
return (NULL); return (NULL);
} }
relnode = ctxt->node; relnode = ctxt->node;
@ -330,7 +330,7 @@ virXPathNodeSet(virConnectPtr conn,
if ((ctxt == NULL) || (xpath == NULL)) { if ((ctxt == NULL) || (xpath == NULL)) {
virXMLError(conn, VIR_ERR_INTERNAL_ERROR, virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
_("Invalid parameter to virXPathNodeSet()")); "%s", _("Invalid parameter to virXPathNodeSet()"));
return (-1); return (-1);
} }

View File

@ -298,7 +298,7 @@ xenStoreOpen(virConnectPtr conn,
*/ */
if (getuid() == 0) { if (getuid() == 0) {
virXenStoreError(NULL, VIR_ERR_NO_XEN, virXenStoreError(NULL, VIR_ERR_NO_XEN,
_("failed to connect to Xen Store")); "%s", _("failed to connect to Xen Store"));
} }
return (-1); return (-1);
} }