On Mon, Dec 05, 2011 at 05:14:10PM +0100, Christophe Fergeau wrote:
GVirConnection has some gvir_set_error uses that can be replaced
by gvir_set_error_set_literal. When passing a single string, this is
safer since we are guaranteed that unwanted printf-format sequences
in the string won't cause issues.
---
libvirt-gobject/libvirt-gobject-connection.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c
b/libvirt-gobject/libvirt-gobject-connection.c
index 50cd860..f478948 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -421,9 +421,9 @@ gboolean gvir_connection_open(GVirConnection *conn,
if (!priv->uri) {
char *uri = virConnectGetURI(priv->conn);
if (!uri) {
- gvir_set_error(err, GVIR_CONNECTION_ERROR,
+ gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
0,
- "%s", "Unable to get connection URI");
+ "Unable to get connection URI");
virConnectClose(priv->conn);
priv->conn = NULL;
g_mutex_unlock(priv->lock);
@@ -618,9 +618,9 @@ gboolean gvir_connection_fetch_domains(GVirConnection *conn,
g_mutex_lock(priv->lock);
if (!priv->conn) {
- g_set_error(err, GVIR_CONNECTION_ERROR,
- 0,
- "Connection is not open");
+ g_set_error_literal(err, GVIR_CONNECTION_ERROR,
+ 0,
+ "Connection is not open");
g_mutex_unlock(priv->lock);
goto cleanup;
}
@@ -633,9 +633,9 @@ gboolean gvir_connection_fetch_domains(GVirConnection *conn,
goto cleanup;
if ((nactive = virConnectNumOfDomains(vconn)) < 0) {
- gvir_set_error(err, GVIR_CONNECTION_ERROR,
- 0,
- "Unable to count domains");
+ gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
+ 0,
+ "Unable to count domains");
goto cleanup;
}
if (nactive) {
@@ -644,9 +644,9 @@ gboolean gvir_connection_fetch_domains(GVirConnection *conn,
active = g_new(gint, nactive);
if ((nactive = virConnectListDomains(vconn, active, nactive)) < 0) {
- gvir_set_error(err, GVIR_CONNECTION_ERROR,
- 0,
- "Unable to list domains");
+ gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
+ 0,
+ "Unable to list domains");
goto cleanup;
}
}
ACK to this + the extra hunk
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|