]> xenbits.xensource.com Git - libvirt.git/commitdiff
maint: don't permit format strings without %
authorEric Blake <eblake@redhat.com>
Mon, 23 Jul 2012 20:33:08 +0000 (14:33 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 26 Jul 2012 20:32:30 +0000 (14:32 -0600)
Any time we have a string with no % passed through gettext, a
translator can inject a % to cause a stack overread.  When there
is nothing to format, it's easier to ask for a string that cannot
be used as a formatter, by using a trivial "%s" format instead.

In the past, we have used --disable-nls to catch some of the
offenders, but that doesn't get run very often, and many more
uses have crept in.  Syntax check to the rescue!

The syntax check can catch uses such as
virReportError(code,
               _("split "
                 "string"));
by using a sed script to fold context lines into one pattern
space before checking for a string without %.

This patch is just mechanical insertion of %s; there are probably
several messages touched by this patch where we would be better
off giving the user more information than a fixed string.

* cfg.mk (sc_prohibit_diagnostic_without_format): New rule.
* src/datatypes.c (virUnrefConnect, virGetDomain)
(virUnrefDomain, virGetNetwork, virUnrefNetwork, virGetInterface)
(virUnrefInterface, virGetStoragePool, virUnrefStoragePool)
(virGetStorageVol, virUnrefStorageVol, virGetNodeDevice)
(virGetSecret, virUnrefSecret, virGetNWFilter, virUnrefNWFilter)
(virGetDomainSnapshot, virUnrefDomainSnapshot): Add %s wrapper.
* src/lxc/lxc_driver.c (lxcDomainSetBlkioParameters)
(lxcDomainGetBlkioParameters): Likewise.
* src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML)
(virDomainDiskDefParseXML, virDomainGraphicsDefParseXML):
Likewise.
* src/conf/network_conf.c (virNetworkDNSHostsDefParseXML)
(virNetworkDefParseXML): Likewise.
* src/conf/nwfilter_conf.c (virNWFilterIsValidChainName):
Likewise.
* src/conf/nwfilter_params.c (virNWFilterVarValueCreateSimple)
(virNWFilterVarAccessParse): Likewise.
* src/libvirt.c (virDomainSave, virDomainSaveFlags)
(virDomainRestore, virDomainRestoreFlags)
(virDomainSaveImageGetXMLDesc, virDomainSaveImageDefineXML)
(virDomainCoreDump, virDomainGetXMLDesc)
(virDomainMigrateVersion1, virDomainMigrateVersion2)
(virDomainMigrateVersion3, virDomainMigrate, virDomainMigrate2)
(virStreamSendAll, virStreamRecvAll)
(virDomainSnapshotGetXMLDesc): Likewise.
* src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopReqLeaseDel)
(virNWFilterDHCPSnoopReq): Likewise.
* src/openvz/openvz_driver.c (openvzUpdateDevice): Likewise.
* src/openvz/openvz_util.c (openvzKBPerPages): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Likewise.
* src/qemu/qemu_command.c (qemuBuildHubDevStr, qemuBuildChrChardevStr)
(qemuBuildCommandLine): Likewise.
* src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/rpc/virnetsaslcontext.c (virNetSASLSessionGetIdentity):
Likewise.
* src/rpc/virnetsocket.c (virNetSocketNewConnectUNIX)
(virNetSocketSendFD, virNetSocketRecvFD): Likewise.
* src/storage/storage_backend_disk.c
(virStorageBackendDiskBuildPool): Likewise.
* src/storage/storage_backend_fs.c
(virStorageBackendFileSystemProbe)
(virStorageBackendFileSystemBuild): Likewise.
* src/storage/storage_backend_rbd.c
(virStorageBackendRBDOpenRADOSConn): Likewise.
* src/storage/storage_driver.c (storageVolumeResize): Likewise.
* src/test/test_driver.c (testInterfaceChangeBegin)
(testInterfaceChangeCommit, testInterfaceChangeRollback):
Likewise.
* src/vbox/vbox_tmpl.c (vboxListAllDomains): Likewise.
* src/xenxs/xen_sxpr.c (xenFormatSxprDisk, xenFormatSxpr):
Likewise.
* src/xenxs/xen_xm.c (xenXMConfigGetUUID, xenFormatXMDisk)
(xenFormatXM): Likewise.

25 files changed:
cfg.mk
src/conf/domain_conf.c
src/conf/network_conf.c
src/conf/nwfilter_conf.c
src/conf/nwfilter_params.c
src/datatypes.c
src/libvirt.c
src/lxc/lxc_driver.c
src/nwfilter/nwfilter_dhcpsnoop.c
src/openvz/openvz_driver.c
src/openvz/openvz_util.c
src/qemu/qemu_cgroup.c
src/qemu/qemu_command.c
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
src/rpc/virnetsaslcontext.c
src/rpc/virnetsocket.c
src/storage/storage_backend_disk.c
src/storage/storage_backend_fs.c
src/storage/storage_backend_rbd.c
src/storage/storage_driver.c
src/test/test_driver.c
src/vbox/vbox_tmpl.c
src/xenxs/xen_sxpr.c
src/xenxs/xen_xm.c

diff --git a/cfg.mk b/cfg.mk
index 882b2bec15f80427ef5cf1201448ffbec3e549a2..68f3a91617965609173fbb76061f2651912770a5 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -581,6 +581,19 @@ sc_prohibit_newline_at_end_of_diagnostic:
          && { echo '$(ME): newline at end of message(s)' 1>&2;         \
            exit 1; } || :
 
+# Look for diagnostics that lack a % in the format string, except that we
+# allow VIR_ERROR to do this, and ignore functions that take a single
+# string rather than a format argument.
+sc_prohibit_diagnostic_without_format:
+       @{ grep     -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT));   \
+          grep -A2 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
+          | sed -rn -e ':l; /[,"]$$/ {N;b l;}'                          \
+               -e '/(xenapiSessionErrorHandler|vah_(error|warning))/d'  \
+               -e '/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p'    \
+           | grep -vE 'VIR_ERROR' &&                                    \
+         { echo '$(ME): found diagnostic without %' 1>&2;               \
+           exit 1; } || :
+
 # The strings "" and "%s" should never be marked for translation.
 sc_prohibit_useless_translation:
        @prohibit='_\("(%s)?"\)'                                        \
index c53722a2aace11902dba3e05408b47c825985021..143d92e07b0c9f8ec1769792404196917b6ed9b4 100644 (file)
@@ -3236,7 +3236,7 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr *def,
     (*def)->label = p;
 
     if ((*def)->label && (*def)->norelabel) {
-        virReportError(VIR_ERR_XML_ERROR,
+        virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("Cannot specify a label if relabelling is turned off"));
         VIR_FREE((*def)->label);
         VIR_FREE(*def);
@@ -3423,7 +3423,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
                     }
                     if (!(source = virXMLPropString(cur, "name")) &&
                         def->protocol != VIR_DOMAIN_DISK_PROTOCOL_NBD) {
-                        virReportError(VIR_ERR_INTERNAL_ERROR,
+                        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                        _("missing name for disk source"));
                         goto error;
                     }
@@ -3509,7 +3509,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
             } else if (xmlStrEqual(cur->name, BAD_CAST "auth")) {
                 authUsername = virXMLPropString(cur, "username");
                 if (authUsername == NULL) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                    _("missing username for auth"));
                     goto error;
                 }
@@ -3521,7 +3521,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
                         xmlStrEqual(child->name, BAD_CAST "secret")) {
                         usageType = virXMLPropString(child, "type");
                         if (usageType == NULL) {
-                            virReportError(VIR_ERR_XML_ERROR,
+                            virReportError(VIR_ERR_XML_ERROR, "%s",
                                            _("missing type for secret"));
                             goto error;
                         }
@@ -3537,7 +3537,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
                         authUsage = virXMLPropString(child, "usage");
 
                         if (authUUID != NULL && authUsage != NULL) {
-                            virReportError(VIR_ERR_XML_ERROR,
+                            virReportError(VIR_ERR_XML_ERROR, "%s",
                                            _("only one of uuid and usage can be specified"));
                             goto error;
                         }
@@ -3599,7 +3599,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
                      def->blkdeviotune.read_bytes_sec) ||
                     (def->blkdeviotune.total_bytes_sec &&
                      def->blkdeviotune.write_bytes_sec)) {
-                    virReportError(VIR_ERR_XML_ERROR,
+                    virReportError(VIR_ERR_XML_ERROR, "%s",
                                    _("total and read/write bytes_sec "
                                      "cannot be set at the same time"));
                     goto error;
@@ -3609,7 +3609,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
                      def->blkdeviotune.read_iops_sec) ||
                     (def->blkdeviotune.total_iops_sec &&
                      def->blkdeviotune.write_iops_sec)) {
-                    virReportError(VIR_ERR_XML_ERROR,
+                    virReportError(VIR_ERR_XML_ERROR, "%s",
                                    _("total and read/write iops_sec "
                                      "cannot be set at the same time"));
                     goto error;
@@ -3825,7 +3825,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
 
     if (ioeventfd) {
         if (def->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("disk ioeventfd mode supported "
                              "only for virtio bus"));
             goto error;
@@ -3843,7 +3843,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
 
     if (event_idx) {
         if (def->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("disk event_idx mode supported "
                              "only for virtio bus"));
             goto error;
@@ -6411,7 +6411,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
                     if ((compressionVal =
                          virDomainGraphicsSpicePlaybackCompressionTypeFromString(compression)) <= 0) {
-                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                        _("unknown spice playback compression"));
                         VIR_FREE(compression);
                         goto error;
@@ -6431,7 +6431,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
                     }
                     if ((modeVal =
                          virDomainGraphicsSpiceStreamingModeTypeFromString(mode)) <= 0) {
-                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                        _("unknown spice streaming mode"));
                         VIR_FREE(mode);
                         goto error;
index 5827f7c79405b6688a43b0cb01ec17b82d824386..eb92d930af81a1099bf7312958d76afb9c1e7837 100644 (file)
@@ -519,7 +519,7 @@ virNetworkDNSHostsDefParseXML(virNetworkDNSDefPtr def,
 
     if (!(ip = virXMLPropString(node, "ip")) ||
         (virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) {
-        virReportError(VIR_ERR_XML_DETAIL,
+        virReportError(VIR_ERR_XML_DETAIL, "%s",
                        _("Missing IP address in DNS host definition"));
         VIR_FREE(ip);
         goto error;
@@ -1086,7 +1086,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
         nForwardPfs = virXPathNodeSet("./pf", ctxt, &forwardPfNodes);
 
         if (nForwardIfs < 0 || nForwardPfs < 0) {
-            virReportError(VIR_ERR_XML_ERROR,
+            virReportError(VIR_ERR_XML_ERROR, "%s",
                            _("No interface pool or SRIOV physical device given"));
             goto error;
         }
@@ -1098,7 +1098,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
             }
 
             if (forwardDev) {
-                virReportError(VIR_ERR_XML_ERROR,
+                virReportError(VIR_ERR_XML_ERROR, "%s",
                                _("A forward Dev should not be used when using a SRIOV PF"));
                 goto error;
             }
@@ -1116,7 +1116,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
             forwardDev = NULL;
             def->nForwardPfs++;
         } else if (nForwardPfs > 1) {
-            virReportError(VIR_ERR_XML_ERROR,
+            virReportError(VIR_ERR_XML_ERROR, "%s",
                            _("Use of more than one physical interface is not allowed"));
             goto error;
         }
index a5e38b2d45005744342b7593c6e8b7713656d93e..665ea0cca2b7bbe76d012a450dd340278fc19796 100644 (file)
@@ -2,7 +2,7 @@
  * nwfilter_conf.c: network filter XML processing
  *                  (derived from storage_conf.c)
  *
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * Copyright (C) 2010-2011 IBM Corporation
@@ -2423,7 +2423,7 @@ virNWFilterIsValidChainName(const char *chainname)
     }
 
     if (chainname[strspn(chainname, VALID_CHAINNAME)] != 0) {
-        virReportError(VIR_ERR_INVALID_ARG,
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("Chain name contains invalid characters"));
         return false;
     }
index 839d7048f8493814bce6118b4db74e3e1d91486a..6f7d5fc204e38c8fde6e23440e514cda0f321a87 100644 (file)
@@ -113,7 +113,7 @@ virNWFilterVarValueCreateSimple(char *value)
     virNWFilterVarValuePtr val;
 
     if (!isValidVarValue(value)) {
-        virReportError(VIR_ERR_INVALID_ARG,
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("Variable value contains invalid character"));
         return NULL;
     }
@@ -998,10 +998,10 @@ virNWFilterVarAccessParse(const char *varAccess)
         }
         if (parseError) {
             if (dest->accessType == VIR_NWFILTER_VAR_ACCESS_ELEMENT)
-                virReportError(VIR_ERR_INVALID_ARG,
+                virReportError(VIR_ERR_INVALID_ARG, "%s",
                                _("Malformatted array index"));
             else
-                virReportError(VIR_ERR_INVALID_ARG,
+                virReportError(VIR_ERR_INVALID_ARG, "%s",
                                _("Malformatted iterator id"));
             goto err_exit;
         }
@@ -1026,7 +1026,7 @@ virNWFilterVarAccessParse(const char *varAccess)
 
         return dest;
     } else {
-        virReportError(VIR_ERR_INVALID_ARG,
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("Malformatted variable"));
     }
 
index 699c4a880e06e680a0d4c9626c0c99a241179960..77dca6f5b1af8a5970df32364f19f5fbbbcfe446 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * datatypes.h: management of structs for public data types
  *
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -138,7 +138,7 @@ virUnrefConnect(virConnectPtr conn) {
     int refs;
 
     if ((!VIR_IS_CONNECT(conn))) {
-        virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
         return -1;
     }
     virMutexLock(&conn->lock);
@@ -173,7 +173,7 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
     char uuidstr[VIR_UUID_STRING_BUFLEN];
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
         return NULL;
     }
     virCheckNonNullArgReturn(name, NULL);
@@ -264,7 +264,8 @@ virUnrefDomain(virDomainPtr domain) {
     int refs;
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibConnError(VIR_ERR_INVALID_DOMAIN, _("bad domain or no connection"));
+        virLibConnError(VIR_ERR_INVALID_DOMAIN, "%s",
+                        _("bad domain or no connection"));
         return -1;
     }
     virMutexLock(&domain->conn->lock);
@@ -300,7 +301,7 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) {
     char uuidstr[VIR_UUID_STRING_BUFLEN];
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
         return NULL;
     }
     virCheckNonNullArgReturn(name, NULL);
@@ -389,7 +390,7 @@ virUnrefNetwork(virNetworkPtr network) {
     int refs;
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibConnError(VIR_ERR_INVALID_NETWORK,
+        virLibConnError(VIR_ERR_INVALID_NETWORK, "%s",
                         _("bad network or no connection"));
         return -1;
     }
@@ -427,7 +428,7 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac) {
     virInterfacePtr ret = NULL;
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
         return NULL;
     }
     virCheckNonNullArgReturn(name, NULL);
@@ -522,7 +523,7 @@ virUnrefInterface(virInterfacePtr iface) {
     int refs;
 
     if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
-        virLibConnError(VIR_ERR_INVALID_INTERFACE,
+        virLibConnError(VIR_ERR_INVALID_INTERFACE, "%s",
                         _("bad interface or no connection"));
         return -1;
     }
@@ -561,7 +562,7 @@ virGetStoragePool(virConnectPtr conn, const char *name,
     char uuidstr[VIR_UUID_STRING_BUFLEN];
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
         return NULL;
     }
     virCheckNonNullArgReturn(name, NULL);
@@ -651,7 +652,7 @@ virUnrefStoragePool(virStoragePoolPtr pool) {
     int refs;
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibConnError(VIR_ERR_INVALID_STORAGE_POOL,
+        virLibConnError(VIR_ERR_INVALID_STORAGE_POOL, "%s",
                         _("bad storage pool or no connection"));
         return -1;
     }
@@ -690,7 +691,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name,
     virStorageVolPtr ret = NULL;
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
         return NULL;
     }
     virCheckNonNullArgReturn(name, NULL);
@@ -790,7 +791,7 @@ virUnrefStorageVol(virStorageVolPtr vol) {
     int refs;
 
     if (!VIR_IS_CONNECTED_STORAGE_VOL(vol)) {
-        virLibConnError(VIR_ERR_INVALID_STORAGE_VOL,
+        virLibConnError(VIR_ERR_INVALID_STORAGE_VOL, "%s",
                         _("bad storage volume or no connection"));
         return -1;
     }
@@ -827,7 +828,7 @@ virGetNodeDevice(virConnectPtr conn, const char *name)
     virNodeDevicePtr ret = NULL;
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
         return NULL;
     }
     virCheckNonNullArgReturn(name, NULL);
@@ -945,7 +946,7 @@ virGetSecret(virConnectPtr conn, const unsigned char *uuid,
     char uuidstr[VIR_UUID_STRING_BUFLEN];
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
         return NULL;
     }
     virCheckNonNullArgReturn(uuid, NULL);
@@ -1031,7 +1032,8 @@ virUnrefSecret(virSecretPtr secret) {
     int refs;
 
     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibConnError(VIR_ERR_INVALID_SECRET, _("bad secret or no connection"));
+        virLibConnError(VIR_ERR_INVALID_SECRET, "%s",
+                        _("bad secret or no connection"));
         return -1;
     }
     virMutexLock(&secret->conn->lock);
@@ -1126,7 +1128,7 @@ virGetNWFilter(virConnectPtr conn, const char *name, const unsigned char *uuid)
     char uuidstr[VIR_UUID_STRING_BUFLEN];
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
         return NULL;
     }
     virCheckNonNullArgReturn(name, NULL);
@@ -1218,7 +1220,7 @@ virUnrefNWFilter(virNWFilterPtr nwfilter)
     int refs;
 
     if (!VIR_IS_CONNECTED_NWFILTER(nwfilter)) {
-        virLibConnError(VIR_ERR_INVALID_NWFILTER,
+        virLibConnError(VIR_ERR_INVALID_NWFILTER, "%s",
                         _("bad nwfilter or no connection"));
         return -1;
     }
@@ -1244,7 +1246,7 @@ virGetDomainSnapshot(virDomainPtr domain, const char *name)
     virDomainSnapshotPtr ret = NULL;
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibConnError(VIR_ERR_INVALID_DOMAIN, _("bad domain"));
+        virLibConnError(VIR_ERR_INVALID_DOMAIN, "%s", _("bad domain"));
         return NULL;
     }
     virCheckNonNullArgReturn(name, NULL);
@@ -1307,7 +1309,8 @@ virUnrefDomainSnapshot(virDomainSnapshotPtr snapshot)
     int refs;
 
     if (!VIR_IS_DOMAIN_SNAPSHOT(snapshot)) {
-        virLibConnError(VIR_ERR_INVALID_DOMAIN_SNAPSHOT, _("not a snapshot"));
+        virLibConnError(VIR_ERR_INVALID_DOMAIN_SNAPSHOT, "%s",
+                        _("not a snapshot"));
         return -1;
     }
 
index 8315b4fca96ec8b3d9166ab447d89d9a6e2ebec2..1ed9e328f2467c447d0b3bc0ac26258aa5c36d60 100644 (file)
@@ -2555,7 +2555,7 @@ virDomainSave(virDomainPtr domain, const char *to)
 
         /* We must absolutize the file path as the save is done out of process */
         if (virFileAbsPath(to, &absolute_to) < 0) {
-            virLibConnError(VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("could not build absolute output file path"));
             goto error;
         }
@@ -2650,7 +2650,7 @@ virDomainSaveFlags(virDomainPtr domain, const char *to,
 
         /* We must absolutize the file path as the save is done out of process */
         if (virFileAbsPath(to, &absolute_to) < 0) {
-            virLibConnError(VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("could not build absolute output file path"));
             goto error;
         }
@@ -2706,7 +2706,7 @@ virDomainRestore(virConnectPtr conn, const char *from)
 
         /* We must absolutize the file path as the restore is done out of process */
         if (virFileAbsPath(from, &absolute_from) < 0) {
-            virLibConnError(VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("could not build absolute input file path"));
             goto error;
         }
@@ -2788,7 +2788,7 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
 
         /* We must absolutize the file path as the restore is done out of process */
         if (virFileAbsPath(from, &absolute_from) < 0) {
-            virLibConnError(VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("could not build absolute input file path"));
             goto error;
         }
@@ -2845,7 +2845,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
     virCheckNonNullArgGoto(file, error);
 
     if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
-        virLibConnError(VIR_ERR_OPERATION_DENIED,
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
                         _("virDomainSaveImageGetXMLDesc with secure flag"));
         goto error;
     }
@@ -2856,7 +2856,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
 
         /* We must absolutize the file path as the read is done out of process */
         if (virFileAbsPath(file, &absolute_file) < 0) {
-            virLibConnError(VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("could not build absolute input file path"));
             goto error;
         }
@@ -2937,7 +2937,7 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const char *file,
 
         /* We must absolutize the file path as the read is done out of process */
         if (virFileAbsPath(file, &absolute_file) < 0) {
-            virLibConnError(VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("could not build absolute input file path"));
             goto error;
         }
@@ -3029,7 +3029,7 @@ virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags)
 
         /* We must absolutize the file path as the save is done out of process */
         if (virFileAbsPath(to, &absolute_to) < 0) {
-            virLibConnError(VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("could not build absolute core file path"));
             goto error;
         }
@@ -4341,7 +4341,7 @@ virDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
     conn = domain->conn;
 
     if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
-        virLibConnError(VIR_ERR_OPERATION_DENIED,
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
                         _("virDomainGetXMLDesc with secure flag"));
         goto error;
     }
@@ -4523,7 +4523,7 @@ virDomainMigrateVersion1 (virDomainPtr domain,
         goto done;
 
     if (uri == NULL && uri_out == NULL) {
-        virLibConnError(VIR_ERR_INTERNAL_ERROR,
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                          _("domainMigratePrepare did not set uri"));
         goto done;
     }
@@ -4635,7 +4635,7 @@ virDomainMigrateVersion2 (virDomainPtr domain,
         goto done;
 
     if (uri == NULL && uri_out == NULL) {
-        virLibConnError(VIR_ERR_INTERNAL_ERROR,
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                          _("domainMigratePrepare2 did not set uri"));
         virDispatchError(domain->conn);
         cancelled = 1;
@@ -4781,7 +4781,7 @@ virDomainMigrateVersion3(virDomainPtr domain,
     }
 
     if (uri == NULL && uri_out == NULL) {
-        virLibConnError(VIR_ERR_INTERNAL_ERROR,
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                         _("domainMigratePrepare3 did not set uri"));
         virDispatchError(domain->conn);
         goto finish;
@@ -5198,7 +5198,7 @@ virDomainMigrate (virDomainPtr domain,
         }
         flags &= ~VIR_MIGRATE_CHANGE_PROTECTION;
         if (flags & VIR_MIGRATE_TUNNELLED) {
-            virLibConnError(VIR_ERR_OPERATION_INVALID,
+            virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
                             _("cannot perform tunnelled migration without using peer2peer flag"));
             goto error;
         }
@@ -5400,7 +5400,7 @@ virDomainMigrate2(virDomainPtr domain,
         }
         flags &= ~VIR_MIGRATE_CHANGE_PROTECTION;
         if (flags & VIR_MIGRATE_TUNNELLED) {
-            virLibConnError(VIR_ERR_OPERATION_INVALID,
+            virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
                             _("cannot perform tunnelled migration without using peer2peer flag"));
             goto error;
         }
@@ -14951,7 +14951,7 @@ int virStreamSendAll(virStreamPtr stream,
     virCheckNonNullArgGoto(handler, cleanup);
 
     if (stream->flags & VIR_STREAM_NONBLOCK) {
-        virLibConnError(VIR_ERR_OPERATION_INVALID,
+        virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
                         _("data sources cannot be used for non-blocking streams"));
         goto cleanup;
     }
@@ -15050,7 +15050,7 @@ int virStreamRecvAll(virStreamPtr stream,
     virCheckNonNullArgGoto(handler, cleanup);
 
     if (stream->flags & VIR_STREAM_NONBLOCK) {
-        virLibConnError(VIR_ERR_OPERATION_INVALID,
+        virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
                         _("data sinks cannot be used for non-blocking streams"));
         goto cleanup;
     }
@@ -17040,7 +17040,7 @@ virDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
     conn = snapshot->domain->conn;
 
     if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
-        virLibConnError(VIR_ERR_OPERATION_DENIED,
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
                         _("virDomainSnapshotGetXMLDesc with secure flag"));
         goto error;
     }
index ba07a80ea3a2838687d9c454f9fb3ea290fcc696..38a5662372cbf8e3dc744f63c108c0d8832f899f 100644 (file)
@@ -2023,7 +2023,8 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
 
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
         if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
-            lxcError(VIR_ERR_OPERATION_INVALID, _("blkio cgroup isn't mounted"));
+            lxcError(VIR_ERR_OPERATION_INVALID, "%s",
+                     _("blkio cgroup isn't mounted"));
             goto cleanup;
         }
 
@@ -2127,7 +2128,8 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
 
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
         if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
-            lxcError(VIR_ERR_OPERATION_INVALID, _("blkio cgroup isn't mounted"));
+            lxcError(VIR_ERR_OPERATION_INVALID, "%s",
+                     _("blkio cgroup isn't mounted"));
             goto cleanup;
         }
 
index aee57ede19149753fbc8330f7ac0ad4feae8f678..1395bfe921b11aa0d08c7d497064dc256280b821 100644 (file)
@@ -2,6 +2,7 @@
  * nwfilter_dhcpsnoop.c: support for DHCP snooping used by a VM
  *                       on an interface
  *
+ * Copyright (C) 2012 Red Hat, Inc.
  * Copyright (C) 2011,2012 IBM Corp.
  *
  * Authors:
@@ -886,7 +887,7 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req,
         if (req->techdriver &&
             req->techdriver->applyDHCPOnlyRules(req->ifname, &req->macaddr,
                                                 dhcpsrvrs, false) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("virNWFilterSnoopListDel failed"));
             ret = -1;
         }
@@ -1633,7 +1634,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
 
     if (techdriver->applyDHCPOnlyRules(req->ifname, &req->macaddr,
                                        dhcpsrvrs, false) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("applyDHCPOnlyRules "
                          "failed - spoofing not protected!"));
         goto exit_snoopreqput;
index 428b9445f1332c3514385a4dfb43865c341f50d6..4cc7f46e3fdaca07873901dc14e1d068c837c094 100644 (file)
@@ -2017,7 +2017,7 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
             || cur->accessmode != fs->accessmode
             || cur->wrpolicy != fs->wrpolicy
             || cur->readonly != fs->readonly) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Can only modify disk quota"));
             return -1;
         }
index 89066ab6a62bd22e30e2fbadd120425d34ba3e75..b817e1626e58a9567f13566290416eeccef588e7 100644 (file)
@@ -45,7 +45,7 @@ openvzKBPerPages(void)
         if (kb_per_pages > 0) {
             kb_per_pages /= 1024;
         } else {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Can't determine page size"));
             kb_per_pages = 0;
             return -1;
index 32184e724b7527bb793dc3589c5e40a9c50ddc12..dee9de6b545e9349df1d6fbcdd934f2f27cf98e8 100644 (file)
@@ -333,7 +333,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
                 }
             }
         } else {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Block I/O tuning is not available on this host"));
             goto cleanup;
         }
@@ -372,7 +372,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
                 }
             }
         } else {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Memory cgroup is not available on this host"));
         }
     }
index edd1840ce9d76ee06cc84b238c36d8b8d25ac06f..403364480afa33baeef3b45b8bef17c9c1b51244 100644 (file)
@@ -3424,7 +3424,7 @@ qemuBuildHubDevStr(virDomainHubDefPtr dev,
     }
 
     if (!qemuCapsGet(qemuCaps, QEMU_CAPS_USB_HUB)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("usb-hub not supported by QEMU binary"));
         goto error;
     }
@@ -3553,7 +3553,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
 
     case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
         if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("spicevmc not supported in this QEMU binary"));
             goto error;
         }
@@ -4808,7 +4808,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                        cont->model == -1 &&
                        !qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
                 if (usblegacy) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("Multiple legacy USB controllers are "
                                      "not supported"));
                     goto error;
@@ -5816,7 +5816,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             switch (mode) {
             case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
                 if (!driver->spiceTLS) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("spice secure channels set in XML configuration, but TLS is disabled in qemu.conf"));
                     goto error;
                 }
index f3ff5b27e3ab9fc1e5366f61b13f952ae423c29e..0da5c5aacf0d9f1a811445cf2cabec9b91ae23f4 100644 (file)
@@ -12885,7 +12885,7 @@ qemuDomainGetPercpuStats(virDomainPtr domain,
         if (!map[i]) {
             cpu_time = 0;
         } else if (virStrToLong_ull(pos, &pos, 10, &cpu_time) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("cpuacct parse error"));
             goto cleanup;
         } else {
index 78806069404df51565b79164bd20938fbf6c7632..ba841e92697ca743229bdee43a7352c53dbf6369 100644 (file)
@@ -832,7 +832,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
                     goto try_remove;
                 }
             } else {
-                virReportError(VIR_ERR_OPERATION_FAILED,
+                virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                                _("setting of link state not supported: Link is up"));
             }
 
index 9c737d0ccf22de669d2a4759d82ad1b0ffef8de5..af6e237064057ce91c4d4a906b29ebf9d727aae7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * virnetsaslcontext.c: SASL encryption/auth handling
  *
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -313,7 +313,7 @@ const char *virNetSASLSessionGetIdentity(virNetSASLSessionPtr sasl)
         goto cleanup;
     }
     if (val == NULL) {
-        virReportError(VIR_ERR_AUTH_FAILED,
+        virReportError(VIR_ERR_AUTH_FAILED, "%s",
                        _("no client username was found"));
         goto cleanup;
     }
index 31c4e2868b212ede9daa3d5beed3e97c0404c6b9..88e55250600a903dacabd54c25030fa95fa33566 100644 (file)
@@ -482,7 +482,7 @@ int virNetSocketNewConnectUNIX(const char *path,
     remoteAddr.len = sizeof(remoteAddr.data.un);
 
     if (spawnDaemon && !binary) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Auto-spawn of daemon requested, but no binary specified"));
         return -1;
     }
@@ -1178,7 +1178,7 @@ int virNetSocketSendFD(virNetSocketPtr sock, int fd)
 {
     int ret = -1;
     if (!virNetSocketHasPassFD(sock)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Sending file descriptors is not supported on this socket"));
         return -1;
     }
@@ -1212,7 +1212,7 @@ int virNetSocketRecvFD(virNetSocketPtr sock, int *fd)
     *fd = -1;
 
     if (!virNetSocketHasPassFD(sock)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Receiving file descriptors is not supported on this socket"));
         return -1;
     }
index 0fc29958e4d580f23bc8df3eb8ebc0d9318b4885..f7f12f5e3a5e60051ed8e9620f057be4237695f8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * storage_backend_disk.c: storage backend for disk handling
  *
- * Copyright (C) 2007-2008, 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2007-2008, 2010-2012 Red Hat, Inc.
  * Copyright (C) 2007-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -399,7 +399,7 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
 
     if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
                   VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("Overwrite and no overwrite flags"
                          " are mutually exclusive"));
         goto error;
@@ -415,10 +415,10 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
         if (check > 0) {
             ok_to_mklabel = true;
         } else if (check < 0) {
-            virReportError(VIR_ERR_OPERATION_FAILED,
+            virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                            _("Error checking for disk label"));
         } else {
-            virReportError(VIR_ERR_OPERATION_INVALID,
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                            _("Disk label already present"));
         }
     }
index 29d63419b5cd6375c6ce69805dcd2b2237901256..01b517ae2d8ecdbcfd598fa2a3db41803abce9ee 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * storage_backend_fs.c: storage backend for FS and directory handling
  *
- * Copyright (C) 2007-2011 Red Hat, Inc.
+ * Copyright (C) 2007-2012 Red Hat, Inc.
  * Copyright (C) 2007-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -598,7 +598,7 @@ virStorageBackendFileSystemProbe(const char *device,
     }
 
     if (blkid_do_probe(probe) != 1) {
-        virReportError(VIR_ERR_STORAGE_PROBE_FAILED,
+        virReportError(VIR_ERR_STORAGE_PROBE_FAILED, "%s",
                        _("Found additional probes to run, "
                          "filesystem probing may be incorrect"));
         ret = FILESYSTEM_PROBE_ERROR;
@@ -620,7 +620,7 @@ static virStoragePoolProbeResult
 virStorageBackendFileSystemProbe(const char *device ATTRIBUTE_UNUSED,
                                  const char *format ATTRIBUTE_UNUSED)
 {
-    virReportError(VIR_ERR_OPERATION_INVALID,
+    virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                    _("probing for filesystems is unsupported "
                      "by this build"));
 
@@ -743,7 +743,7 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
     if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
                   VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
 
-        virReportError(VIR_ERR_OPERATION_INVALID,
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("Overwrite and no overwrite flags"
                          " are mutually exclusive"));
         goto error;
index 0342e9fedc4879f37a98fa69737b2ad7d6a359c6..cd37ce7c9e362e42a760ecff6f1db169d489b841 100644 (file)
@@ -65,7 +65,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
         VIR_DEBUG("Using cephx authorization");
         if (rados_create(&ptr->cluster,
             pool->def->source.auth.cephx.username) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("failed to initialize RADOS"));
             goto cleanup;
         }
@@ -84,7 +84,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
         }
 
         if (secret == NULL) {
-            virReportError(VIR_ERR_NO_SECRET,
+            virReportError(VIR_ERR_NO_SECRET, "%s",
                            _("failed to find the secret"));
             goto cleanup;
         }
@@ -95,7 +95,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
         memset(secret_value, 0, secret_value_size);
 
         if (rados_key == NULL) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("failed to decode the RADOS key"));
             goto cleanup;
         }
@@ -119,7 +119,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
     } else {
         VIR_DEBUG("Not using cephx authorization");
         if (rados_create(&ptr->cluster, NULL) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("failed to create the RADOS cluster"));
             goto cleanup;
         }
index 4ad9155b4e3e76f58c11ac9fea2af0499b50ce70..6d7dd2b95df1882ebe22ae38cedfb35c5cc43c78 100644 (file)
@@ -1715,13 +1715,13 @@ storageVolumeResize(virStorageVolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virReportError(VIR_ERR_NO_STORAGE_POOL,
+        virReportError(VIR_ERR_NO_STORAGE_POOL, "%s",
                        _("no storage pool with matching uuid"));
         goto out;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("storage pool is not active"));
         goto out;
     }
@@ -1753,20 +1753,20 @@ storageVolumeResize(virStorageVolPtr obj,
     }
 
     if (abs_capacity < vol->allocation) {
-        virReportError(VIR_ERR_INVALID_ARG,
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("can't shrink capacity below "
                          "existing allocation"));
         goto out;
     }
 
     if (abs_capacity > vol->capacity + pool->def->available) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("Not enough space left on storage pool"));
         goto out;
     }
 
     if (!backend->resizeVol) {
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_NO_SUPPORT, "%s",
                        _("storage pool does not support changing of "
                          "volume capacity"));
         goto out;
index 3c2056effe821036c93aa70213452dea6a724efa..01e515aa8b66cbd64b7a1ccc35930149c19b8b2b 100644 (file)
@@ -3534,7 +3534,7 @@ static int testInterfaceChangeBegin(virConnectPtr conn,
 
     testDriverLock(privconn);
     if (privconn->transaction_running) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("there is another transaction running."));
         goto cleanup;
     }
@@ -3562,7 +3562,7 @@ static int testInterfaceChangeCommit(virConnectPtr conn,
     testDriverLock(privconn);
 
     if (!privconn->transaction_running) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("no transaction running, "
                          "nothing to be committed."));
         goto cleanup;
@@ -3590,7 +3590,7 @@ static int testInterfaceChangeRollback(virConnectPtr conn,
     testDriverLock(privconn);
 
     if (!privconn->transaction_running) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("no transaction running, "
                          "nothing to rollback."));
         goto cleanup;
index 17e7e9a6adad3ae5570298b8cde5aff31c979ed4..b672b24ac6acc1ba10df6b2b766425521b337c81 100644 (file)
@@ -9311,7 +9311,7 @@ vboxListAllDomains(virConnectPtr conn,
                 if (MATCH(VIR_CONNECT_LIST_FILTERS_SNAPSHOT)) {
                     rc = machine->vtbl->GetSnapshotCount(machine, &snapshotCount);
                     if (NS_FAILED(rc)) {
-                        virReportError(VIR_ERR_INTERNAL_ERROR,
+                        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                        _("could not get snapshot count for listed domains"));
                         goto cleanup;
                     }
index c84ce35e9067053608fbadde27b5e8367eeca8ac..8bb3849580bae99980c5c519c6992fa6831dba1a 100644 (file)
@@ -1870,7 +1870,7 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
     else
         virBufferAddLit(buf, "(mode 'w')");
     if (def->transient) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("transient disks not supported yet"));
         return -1;
     }
@@ -2515,7 +2515,7 @@ xenFormatSxpr(virConnectPtr conn,
                 break;
             case VIR_DOMAIN_CLOCK_OFFSET_UTC:
                 if (def->clock.data.utc_reset) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("unsupported clock adjustment='reset'"));
                     goto error;
                 }
@@ -2524,7 +2524,7 @@ xenFormatSxpr(virConnectPtr conn,
                 break;
             case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
                 if (def->clock.data.utc_reset) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("unsupported clock adjustment='reset'"));
                     goto error;
                 }
index 20347d31eace93a7eb97dc75e9bd45b28942dec4..5122866b0ed453380006b293757e4faf0f16a7a7 100644 (file)
@@ -208,7 +208,7 @@ static int xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char *
     virConfValuePtr val;
 
     if (!uuid || !name || !conf) {
-        virReportError(VIR_ERR_INVALID_ARG,
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("Arguments must be non null"));
         return -1;
     }
@@ -1242,7 +1242,7 @@ static int xenFormatXMDisk(virConfValuePtr list,
     else
         virBufferAddLit(&buf, ",w");
     if (disk->transient) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("transient disks not supported yet"));
         return -1;
     }
@@ -1686,7 +1686,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
                 break;
             case VIR_DOMAIN_CLOCK_OFFSET_UTC:
                 if (def->clock.data.utc_reset) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("unsupported clock adjustment='reset'"));
                     goto cleanup;
                 }
@@ -1695,7 +1695,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
                 break;
             case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
                 if (def->clock.data.utc_reset) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("unsupported clock adjustment='reset'"));
                     goto cleanup;
                 }