On Tue, Nov 22, 2011 at 4:18 PM, Daniel P. Berrange <berrange@xxxxxxxxxx> wrote: > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > --- > libvirt-gobject/libvirt-gobject-connection.c | 104 +++++++++++++--------- > libvirt-gobject/libvirt-gobject-domain.c | 70 ++++++++------ > libvirt-gobject/libvirt-gobject-interface.c | 7 +- > libvirt-gobject/libvirt-gobject-network-filter.c | 7 +- > libvirt-gobject/libvirt-gobject-network.c | 7 +- > libvirt-gobject/libvirt-gobject-node-device.c | 7 +- > libvirt-gobject/libvirt-gobject-secret.c | 7 +- > libvirt-gobject/libvirt-gobject-storage-pool.c | 53 +++++++----- > libvirt-gobject/libvirt-gobject-storage-vol.c | 7 +- > 9 files changed, 158 insertions(+), 111 deletions(-) > > diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c > index affb496..35be5e3 100644 > --- a/libvirt-gobject/libvirt-gobject-connection.c > +++ b/libvirt-gobject/libvirt-gobject-connection.c > @@ -389,19 +389,21 @@ gboolean gvir_connection_open(GVirConnection *conn, > > g_mutex_lock(priv->lock); > if (priv->conn) { > - *err = g_error_new(GVIR_CONNECTION_ERROR, > - 0, > - "Connection %s is already open", > - priv->uri); > + if (err) > + *err = g_error_new(GVIR_CONNECTION_ERROR, > + 0, > + "Connection %s is already open", > + priv->uri); > g_mutex_unlock(priv->lock); > return FALSE; > } I think we better just make use of g_set_error as it does the null check for us. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list