[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 26/30] Remove virConnectPtr from error reporting in libvirt.c



---
 src/libvirt.c | 1577 +++++++++++++++++++++++++--------------------------------
 1 files changed, 697 insertions(+), 880 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index fb683c0..788b943 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -428,38 +428,19 @@ DllMain (HINSTANCE instance ATTRIBUTE_UNUSED,
 }
 #endif
 
-
-/**
- * virLibConnError:
- * @conn: the connection if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the connection level
- */
-static void
-virLibConnError(virConnectPtr conn, virErrorNumber error, const char *info)
-{
-    const char *errmsg;
-
-    if (error == VIR_ERR_OK)
-        return;
-
-    errmsg = virErrorMsg(error, info);
-    virRaiseError(conn, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_ERROR,
-                  errmsg, info, NULL, 0, 0, errmsg, info);
-}
+#define virLibConnError(code, ...)                                            \
+    virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__,                 \
+                         __FUNCTION__, __LINE__, __VA_ARGS__)
 
 /**
  * virLibConnWarning:
- * @conn: the connection if available
  * @error: the error number
  * @info: extra information string
  *
- * Handle an error at the connection level
+ * Handle a warning at the connection level
  */
 static void
-virLibConnWarning(virConnectPtr conn, virErrorNumber error, const char *info)
+virLibConnWarning(virErrorNumber error, const char *info)
 {
     const char *errmsg;
 
@@ -467,220 +448,41 @@ virLibConnWarning(virConnectPtr conn, virErrorNumber error, const char *info)
         return;
 
     errmsg = virErrorMsg(error, info);
-    virRaiseError(conn, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_WARNING,
-                  errmsg, info, NULL, 0, 0, errmsg, info);
-}
-
-/**
- * virLibDomainError:
- * @domain: the domain if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the connection level
- */
-static void
-virLibDomainError(virDomainPtr domain, virErrorNumber error,
-                  const char *info)
-{
-    virConnectPtr conn = NULL;
-    const char *errmsg;
-
-    if (error == VIR_ERR_OK)
-        return;
-
-    errmsg = virErrorMsg(error, info);
-    if (error != VIR_ERR_INVALID_DOMAIN) {
-        conn = domain->conn;
-    }
-    virRaiseError(conn, domain, NULL, VIR_FROM_DOM, error, VIR_ERR_ERROR,
-                  errmsg, info, NULL, 0, 0, errmsg, info);
-}
-
-/**
- * virLibNetworkError:
- * @conn: the connection if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the connection level
- */
-static void
-virLibNetworkError(virNetworkPtr network, virErrorNumber error,
-                   const char *info)
-{
-    virConnectPtr conn = NULL;
-    const char *errmsg;
-
-    if (error == VIR_ERR_OK)
-        return;
-
-    errmsg = virErrorMsg(error, info);
-    if (error != VIR_ERR_INVALID_NETWORK) {
-        conn = network->conn;
-    }
-    virRaiseError(conn, NULL, network, VIR_FROM_NET, error, VIR_ERR_ERROR,
-                  errmsg, info, NULL, 0, 0, errmsg, info);
-}
-
-/**
- * virLibInterfaceError:
- * @conn: the connection if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the connection level
- */
-static void
-virLibInterfaceError(virInterfacePtr iface, virErrorNumber error,
-                   const char *info)
-{
-    virConnectPtr conn = NULL;
-    const char *errmsg;
-
-    if (error == VIR_ERR_OK)
-        return;
-
-    errmsg = virErrorMsg(error, info);
-    if (error != VIR_ERR_INVALID_INTERFACE) {
-        conn = iface->conn;
-    }
-    virRaiseError(conn, NULL, NULL, VIR_FROM_INTERFACE, error, VIR_ERR_ERROR,
-                  errmsg, info, NULL, 0, 0, errmsg, info);
-}
-
-/**
- * virLibStoragePoolError:
- * @conn: the connection if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the connection level
- */
-static void
-virLibStoragePoolError(virStoragePoolPtr pool, virErrorNumber error,
-                       const char *info)
-{
-    virConnectPtr conn = NULL;
-    const char *errmsg;
-
-    if (error == VIR_ERR_OK)
-        return;
-
-    errmsg = virErrorMsg(error, info);
-    if (error != VIR_ERR_INVALID_STORAGE_POOL)
-        conn = pool->conn;
-
-    virRaiseError(conn, NULL, NULL, VIR_FROM_STORAGE, error, VIR_ERR_ERROR,
+    virRaiseError(NULL, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_WARNING,
                   errmsg, info, NULL, 0, 0, errmsg, info);
 }
 
-/**
- * virLibStorageVolError:
- * @conn: the connection if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the connection level
- */
-static void
-virLibStorageVolError(virStorageVolPtr vol, virErrorNumber error,
-                      const char *info)
-{
-    virConnectPtr conn = NULL;
-    const char *errmsg;
-
-    if (error == VIR_ERR_OK)
-        return;
-
-    errmsg = virErrorMsg(error, info);
-    if (error != VIR_ERR_INVALID_STORAGE_VOL)
-        conn = vol->conn;
-
-    virRaiseError(conn, NULL, NULL, VIR_FROM_STORAGE, error, VIR_ERR_ERROR,
-                  errmsg, info, NULL, 0, 0, errmsg, info);
-}
-
-/**
- * virLibNodeDeviceError:
- * @dev: the device if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the node device level
- */
-static void
-virLibNodeDeviceError(virNodeDevicePtr dev, virErrorNumber error,
-                      const char *info)
-{
-    virConnectPtr conn = NULL;
-    const char *errmsg;
-
-    if (error == VIR_ERR_OK)
-        return;
-
-    errmsg = virErrorMsg(error, info);
-    if (error != VIR_ERR_INVALID_NODE_DEVICE)
-        conn = dev->conn;
-
-    virRaiseError(conn, NULL, NULL, VIR_FROM_NODEDEV, error, VIR_ERR_ERROR,
-                    errmsg, info, NULL, 0, 0, errmsg, info);
-}
-
-#define virLibStreamError(conn, code, ...)                      \
-    virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__,   \
+#define virLibDomainError(code, ...)                                          \
+    virReportErrorHelper(NULL, VIR_FROM_DOM, code, __FILE__,                  \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
 
-/**
- * virLibSecretError:
- * @secret: the secret if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the secret level
- */
-static void
-virLibSecretError(virSecretPtr secret, virErrorNumber error, const char *info)
-{
-    virConnectPtr conn = NULL;
-    const char *errmsg;
-
-    if (error == VIR_ERR_OK)
-        return;
+#define virLibNetworkError(code, ...)                                         \
+    virReportErrorHelper(NULL, VIR_FROM_NET, code, __FILE__,                  \
+                         __FUNCTION__, __LINE__, __VA_ARGS__)
 
-    errmsg = virErrorMsg(error, info);
-    if (error != VIR_ERR_INVALID_SECRET)
-        conn = secret->conn;
+#define virLibInterfaceError(code, ...)                                       \
+    virReportErrorHelper(NULL, VIR_FROM_INTERFACE, code, __FILE__,            \
+                         __FUNCTION__, __LINE__, __VA_ARGS__)
 
-    virRaiseError(conn, NULL, NULL, VIR_FROM_SECRET, error, VIR_ERR_ERROR,
-                  errmsg, info, NULL, 0, 0, errmsg, info);
-}
+#define virLibStoragePoolError(code, ...)                                     \
+    virReportErrorHelper(NULL, VIR_FROM_STORAGE, code, __FILE__,              \
+                         __FUNCTION__, __LINE__, __VA_ARGS__)
 
-/**
- * virLibNWFilterError:
- * @conn: the connection if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the connection level
- */
-static void
-virLibNWFilterError(virNWFilterPtr pool, virErrorNumber error,
-                    const char *info)
-{
-    virConnectPtr conn = NULL;
-    const char *errmsg;
+#define virLibStorageVolError(code, ...)                                      \
+    virReportErrorHelper(NULL, VIR_FROM_STORAGE, code, __FILE__,              \
+                         __FUNCTION__, __LINE__, __VA_ARGS__)
 
-    if (error == VIR_ERR_OK)
-        return;
+#define virLibNodeDeviceError(code, ...)                                      \
+    virReportErrorHelper(NULL, VIR_FROM_NODEDEV, code, __FILE__,              \
+                         __FUNCTION__, __LINE__, __VA_ARGS__)
 
-    errmsg = virErrorMsg(error, info);
-    if (error != VIR_ERR_INVALID_NWFILTER)
-        conn = pool->conn;
+#define virLibSecretError(code, ...)                                          \
+    virReportErrorHelper(NULL, VIR_FROM_SECRET, code, __FILE__,               \
+                         __FUNCTION__, __LINE__, __VA_ARGS__)
 
-    virRaiseError(conn, NULL, NULL, VIR_FROM_NWFILTER, error, VIR_ERR_ERROR,
-                  errmsg, info, NULL, 0, 0, errmsg, info);
-}
+#define virLibNWFilterError(code, ...)                                        \
+    virReportErrorHelper(NULL, VIR_FROM_NWFILTER, code, __FILE__,             \
+                         __FUNCTION__, __LINE__, __VA_ARGS__)
 
 /**
  * virRegisterNetworkDriver:
@@ -697,12 +499,12 @@ virRegisterNetworkDriver(virNetworkDriverPtr driver)
       return -1;
 
     if (driver == NULL) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
     if (virNetworkDriverTabCount >= MAX_DRIVERS) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
@@ -728,12 +530,12 @@ virRegisterInterfaceDriver(virInterfaceDriverPtr driver)
       return -1;
 
     if (driver == NULL) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
     if (virInterfaceDriverTabCount >= MAX_DRIVERS) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
@@ -759,12 +561,12 @@ virRegisterStorageDriver(virStorageDriverPtr driver)
       return -1;
 
     if (driver == NULL) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
     if (virStorageDriverTabCount >= MAX_DRIVERS) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
@@ -790,12 +592,12 @@ virRegisterDeviceMonitor(virDeviceMonitorPtr driver)
       return -1;
 
     if (driver == NULL) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
     if (virDeviceMonitorTabCount >= MAX_DRIVERS) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
@@ -821,12 +623,12 @@ virRegisterSecretDriver(virSecretDriverPtr driver)
       return -1;
 
     if (driver == NULL) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
     if (virSecretDriverTabCount >= MAX_DRIVERS) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
@@ -852,12 +654,12 @@ virRegisterNWFilterDriver(virNWFilterDriverPtr driver)
       return -1;
 
     if (driver == NULL) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return -1;
     }
 
     if (virNWFilterDriverTabCount >= MAX_DRIVERS) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return -1;
     }
 
@@ -884,19 +686,18 @@ virRegisterDriver(virDriverPtr driver)
       return -1;
 
     if (driver == NULL) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
     if (virDriverTabCount >= MAX_DRIVERS) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
     if (driver->no < 0) {
-        virLibConnError
-            (NULL, VIR_ERR_INVALID_ARG,
-             "virRegisterDriver: tried to register an internal Xen driver");
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s",
+                        _("Tried to register an internal Xen driver"));
         return -1;
     }
 
@@ -923,12 +724,12 @@ virRegisterStateDriver(virStateDriverPtr driver)
       return -1;
 
     if (driver == NULL) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
     if (virStateDriverTabCount >= MAX_DRIVERS) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         return(-1);
     }
 
@@ -1107,7 +908,7 @@ virGetVersion(unsigned long *libVer, const char *type,
             *typeVer = remoteVersion();
 # endif
         if (*typeVer == 0) {
-            virLibConnError(NULL, VIR_ERR_NO_SUPPORT, type);
+            virLibConnError(VIR_ERR_NO_SUPPORT, "%s", type);
             goto error;
         }
 #endif /* WITH_DRIVER_MODULES */
@@ -1161,8 +962,8 @@ do_open (const char *name,
 
         ret->uri = xmlParseURI (name);
         if (!ret->uri) {
-            virLibConnError (ret, VIR_ERR_INVALID_ARG,
-                             _("could not parse connection URI"));
+            virLibConnError(VIR_ERR_INVALID_ARG, "%s",
+                            _("could not parse connection URI"));
             goto failed;
         }
 
@@ -1204,7 +1005,7 @@ do_open (const char *name,
 
     if (!ret->driver) {
         /* If we reach here, then all drivers declined the connection. */
-        virLibConnError (NULL, VIR_ERR_NO_CONNECT, name);
+        virLibConnError(VIR_ERR_NO_CONNECT, "%s", name);
         goto failed;
     }
 
@@ -1217,8 +1018,8 @@ do_open (const char *name,
                (res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
         if (res == VIR_DRV_OPEN_ERROR) {
             if (STREQ(virNetworkDriverTab[i]->name, "remote")) {
-                virLibConnWarning (NULL, VIR_WAR_NO_NETWORK,
-                                   "Is the daemon running ?");
+                virLibConnWarning(VIR_WAR_NO_NETWORK,
+                                  "Is the daemon running ?");
             }
             break;
         } else if (res == VIR_DRV_OPEN_SUCCESS) {
@@ -1236,8 +1037,8 @@ do_open (const char *name,
                (res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
         if (res == VIR_DRV_OPEN_ERROR) {
             if (STREQ(virInterfaceDriverTab[i]->name, "remote")) {
-                virLibConnWarning (NULL, VIR_WAR_NO_INTERFACE,
-                                   "Is the daemon running ?");
+                virLibConnWarning(VIR_WAR_NO_INTERFACE,
+                                  "Is the daemon running ?");
             }
             break;
         } else if (res == VIR_DRV_OPEN_SUCCESS) {
@@ -1256,8 +1057,8 @@ do_open (const char *name,
                (res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
         if (res == VIR_DRV_OPEN_ERROR) {
             if (STREQ(virStorageDriverTab[i]->name, "remote")) {
-                virLibConnWarning (NULL, VIR_WAR_NO_STORAGE,
-                                   "Is the daemon running ?");
+                virLibConnWarning(VIR_WAR_NO_STORAGE,
+                                  "Is the daemon running ?");
             }
             break;
          } else if (res == VIR_DRV_OPEN_SUCCESS) {
@@ -1276,13 +1077,13 @@ do_open (const char *name,
                (res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
         if (res == VIR_DRV_OPEN_ERROR) {
             if (STREQ(virDeviceMonitorTab[i]->name, "remote")) {
-                virLibConnWarning (NULL, VIR_WAR_NO_NODE,
-                                   "Is the libvirtd daemon running ?");
+                virLibConnWarning(VIR_WAR_NO_NODE,
+                                  "Is the libvirtd daemon running ?");
             } else {
                 char *msg;
                 if (virAsprintf(&msg, "Is the %s daemon running?",
                                 virDeviceMonitorTab[i]->name) > 0) {
-                    virLibConnWarning (NULL, VIR_WAR_NO_NODE, msg);
+                    virLibConnWarning(VIR_WAR_NO_NODE, msg);
                     VIR_FREE(msg);
                 }
             }
@@ -1303,8 +1104,8 @@ do_open (const char *name,
                (res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
         if (res == VIR_DRV_OPEN_ERROR) {
             if (STREQ(virSecretDriverTab[i]->name, "remote")) {
-                virLibConnWarning (NULL, VIR_WAR_NO_SECRET,
-                                   "Is the daemon running ?");
+                virLibConnWarning(VIR_WAR_NO_SECRET,
+                                  "Is the daemon running ?");
             }
             break;
          } else if (res == VIR_DRV_OPEN_SUCCESS) {
@@ -1323,8 +1124,8 @@ do_open (const char *name,
                (res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
         if (res == VIR_DRV_OPEN_ERROR) {
             if (STREQ(virNWFilterDriverTab[i]->name, "remote")) {
-                virLibConnWarning (NULL, VIR_WAR_NO_NWFILTER,
-                                   _("Is the daemon running ?"));
+                virLibConnWarning(VIR_WAR_NO_NWFILTER,
+                                  _("Is the daemon running ?"));
             }
             break;
          } else if (res == VIR_DRV_OPEN_SUCCESS) {
@@ -1474,7 +1275,7 @@ virConnectClose(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -1509,7 +1310,7 @@ int
 virConnectRef(virConnectPtr conn)
 {
     if ((!VIR_IS_CONNECT(conn))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return(-1);
     }
@@ -1533,7 +1334,7 @@ virDrvSupportsFeature (virConnectPtr conn, int feature)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -1566,7 +1367,7 @@ virConnectGetType(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -1599,13 +1400,13 @@ virConnectGetVersion(virConnectPtr conn, unsigned long *hvVer)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if (hvVer == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -1616,7 +1417,7 @@ virConnectGetVersion(virConnectPtr conn, unsigned long *hvVer)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -1643,13 +1444,13 @@ virConnectGetLibVersion(virConnectPtr conn, unsigned long *libVer)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if (libVer == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -1688,7 +1489,7 @@ virConnectGetHostname (virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -1700,7 +1501,7 @@ virConnectGetHostname (virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -1731,7 +1532,7 @@ virConnectGetURI (virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -1768,7 +1569,7 @@ virConnectGetMaxVcpus(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -1780,7 +1581,7 @@ virConnectGetMaxVcpus(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 error:
     virDispatchError(conn);
     return -1;
@@ -1804,13 +1605,13 @@ virConnectListDomains(virConnectPtr conn, int *ids, int maxids)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if ((ids == NULL) || (maxids < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -1821,7 +1622,8 @@ virConnectListDomains(virConnectPtr conn, int *ids, int maxids)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(conn);
     return -1;
@@ -1843,7 +1645,7 @@ virConnectNumOfDomains(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -1855,7 +1657,8 @@ virConnectNumOfDomains(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(conn);
     return -1;
@@ -1883,7 +1686,7 @@ virDomainGetConnect (virDomainPtr dom)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
-        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -1914,16 +1717,16 @@ virDomainCreateXML(virConnectPtr conn, const char *xmlDesc,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (xmlDesc == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -1935,7 +1738,8 @@ virDomainCreateXML(virConnectPtr conn, const char *xmlDesc,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(conn);
     return NULL;
@@ -1980,12 +1784,12 @@ virDomainLookupByID(virConnectPtr conn, int id)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (id < 0) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -1997,7 +1801,7 @@ virDomainLookupByID(virConnectPtr conn, int id)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -2022,12 +1826,12 @@ virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuid == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2039,7 +1843,7 @@ virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -2065,17 +1869,17 @@ virDomainLookupByUUIDString(virConnectPtr conn, const char *uuidstr)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuidstr == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
     if (virUUIDParse(uuidstr, uuid) < 0) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2104,12 +1908,12 @@ virDomainLookupByName(virConnectPtr conn, const char *name)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (name == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2121,7 +1925,7 @@ virDomainLookupByName(virConnectPtr conn, const char *name)
         return dom;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -2149,14 +1953,14 @@ virDomainDestroy(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     conn = domain->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2168,7 +1972,7 @@ virDomainDestroy(virDomainPtr domain)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -2192,7 +1996,7 @@ virDomainFree(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -2224,7 +2028,7 @@ int
 virDomainRef(virDomainPtr domain)
 {
     if ((!VIR_IS_CONNECTED_DOMAIN(domain))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return(-1);
     }
@@ -2257,12 +2061,12 @@ virDomainSuspend(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2276,7 +2080,7 @@ virDomainSuspend(virDomainPtr domain)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2302,12 +2106,12 @@ virDomainResume(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2321,7 +2125,7 @@ virDomainResume(virDomainPtr domain)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2350,17 +2154,17 @@ virDomainSave(virDomainPtr domain, const char *to)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
     if (to == NULL) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2392,7 +2196,7 @@ virDomainSave(virDomainPtr domain, const char *to)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2417,16 +2221,16 @@ virDomainRestore(virConnectPtr conn, const char *from)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (from == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2439,14 +2243,14 @@ virDomainRestore(virConnectPtr conn, const char *from)
 
         t = strlen(from);
         if (getcwd(filepath, sizeof(filepath) - (t + 3)) == NULL) {
-            virLibConnError(conn, VIR_ERR_SYSTEM_ERROR,
+            virLibConnError(VIR_ERR_SYSTEM_ERROR, "%s",
                             _("cannot get working directory"));
             goto error;
         }
         len = strlen(filepath);
         /* that should be covered by getcwd() semantic, but be 100% sure */
         if (len > sizeof(filepath) - (t + 3)) {
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("path too long"));
             goto error;
         }
@@ -2463,7 +2267,7 @@ virDomainRestore(virConnectPtr conn, const char *from)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -2492,17 +2296,17 @@ virDomainCoreDump(virDomainPtr domain, const char *to, int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
     if (to == NULL) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2515,14 +2319,14 @@ virDomainCoreDump(virDomainPtr domain, const char *to, int flags)
 
         t = strlen(to);
         if (getcwd(filepath, sizeof(filepath) - (t + 3)) == NULL) {
-            virLibDomainError(domain, VIR_ERR_SYSTEM_ERROR,
+            virLibDomainError(VIR_ERR_SYSTEM_ERROR, "%s",
                               _("cannot get current directory"));
             goto error;
         }
         len = strlen(filepath);
         /* that should be covered by getcwd() semantic, but be 100% sure */
         if (len > sizeof(filepath) - (t + 3)) {
-            virLibDomainError(domain, VIR_ERR_INTERNAL_ERROR,
+            virLibDomainError(VIR_ERR_INTERNAL_ERROR, "%s",
                               _("path too long"));
             goto error;
         }
@@ -2540,7 +2344,7 @@ virDomainCoreDump(virDomainPtr domain, const char *to, int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2569,12 +2373,12 @@ virDomainShutdown(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2588,7 +2392,7 @@ virDomainShutdown(virDomainPtr domain)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2615,12 +2419,12 @@ virDomainReboot(virDomainPtr domain, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2634,7 +2438,7 @@ virDomainReboot(virDomainPtr domain, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2658,7 +2462,7 @@ virDomainGetName(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -2682,12 +2486,12 @@ virDomainGetUUID(virDomainPtr domain, unsigned char *uuid)
     virResetLastError();
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (uuid == NULL) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(domain->conn);
         return (-1);
     }
@@ -2716,12 +2520,12 @@ virDomainGetUUIDString(virDomainPtr domain, char *buf)
     virResetLastError();
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (buf == NULL) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2752,7 +2556,7 @@ virDomainGetID(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return ((unsigned int) -1);
     }
@@ -2777,7 +2581,7 @@ virDomainGetOSType(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -2792,7 +2596,7 @@ virDomainGetOSType(virDomainPtr domain)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2818,7 +2622,7 @@ virDomainGetMaxMemory(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (0);
     }
@@ -2833,7 +2637,7 @@ virDomainGetMaxMemory(virDomainPtr domain)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2864,16 +2668,16 @@ virDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (memory < 4096) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
@@ -2886,7 +2690,7 @@ virDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2917,16 +2721,16 @@ virDomainSetMemory(virDomainPtr domain, unsigned long memory)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (memory < 4096) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2940,7 +2744,7 @@ virDomainSetMemory(virDomainPtr domain, unsigned long memory)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -2967,12 +2771,12 @@ virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (info == NULL) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -2988,7 +2792,7 @@ virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -3015,7 +2819,7 @@ virDomainGetXMLDesc(virDomainPtr domain, int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -3023,7 +2827,7 @@ virDomainGetXMLDesc(virDomainPtr domain, int flags)
     conn = domain->conn;
 
     if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED,
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
                         _("virDomainGetXMLDesc with secure flag"));
         goto error;
     }
@@ -3038,7 +2842,7 @@ virDomainGetXMLDesc(virDomainPtr domain, int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -3069,13 +2873,13 @@ char *virConnectDomainXMLFromNative(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
 
     if (nativeFormat == NULL || nativeConfig == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3090,7 +2894,7 @@ char *virConnectDomainXMLFromNative(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -3121,13 +2925,13 @@ char *virConnectDomainXMLToNative(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
 
     if (nativeFormat == NULL || domainXml == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3142,7 +2946,7 @@ char *virConnectDomainXMLToNative(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -3186,7 +2990,7 @@ virDomainMigrateVersion1 (virDomainPtr domain,
         goto done;
 
     if (uri == NULL && uri_out == NULL) {
-        virLibConnError (domain->conn, VIR_ERR_INTERNAL_ERROR,
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                          _("domainMigratePrepare did not set uri"));
         goto done;
     }
@@ -3252,7 +3056,7 @@ virDomainMigrateVersion2 (virDomainPtr domain,
      * and pass it to Prepare2.
      */
     if (!domain->conn->driver->domainDumpXML) {
-        virLibConnError (domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s", __FUNCTION__);
         virDispatchError(domain->conn);
         return NULL;
     }
@@ -3275,7 +3079,7 @@ virDomainMigrateVersion2 (virDomainPtr domain,
         goto done;
 
     if (uri == NULL && uri_out == NULL) {
-        virLibConnError (domain->conn, VIR_ERR_INTERNAL_ERROR,
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
                          _("domainMigratePrepare2 did not set uri"));
         virDispatchError(domain->conn);
         goto done;
@@ -3329,7 +3133,7 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
                            unsigned long bandwidth)
 {
     if (!domain->conn->driver->domainMigratePerform) {
-        virLibConnError (domain->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+        virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
         virDispatchError(domain->conn);
         return -1;
     }
@@ -3365,7 +3169,7 @@ virDomainMigrateDirect (virDomainPtr domain,
                         unsigned long bandwidth)
 {
     if (!domain->conn->driver->domainMigratePerform) {
-        virLibConnError (domain->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+        virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
         virDispatchError(domain->conn);
         return -1;
     }
@@ -3464,23 +3268,23 @@ virDomainMigrate (virDomainPtr domain,
 
     /* First checkout the source */
     if (!VIR_IS_CONNECTED_DOMAIN (domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
     /* Now checkout the destination */
     if (!VIR_IS_CONNECT(dconn)) {
-        virLibConnError(domain->conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         goto error;
     }
     if (dconn->flags & VIR_CONNECT_RO) {
         /* NB, deliberately report error against source object, not dest */
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3503,13 +3307,14 @@ virDomainMigrate (virDomainPtr domain,
             ddomain = virDomainLookupByName (dconn, dname ? dname : domain->name);
         } else {
             /* This driver does not support peer to peer migration */
-            virLibConnError (domain->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+            virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
             goto error;
         }
     } else {
         if (flags & VIR_MIGRATE_TUNNELLED) {
-            virLibConnError(domain->conn, VIR_ERR_OPERATION_INVALID,
-                            _("cannot perform tunnelled migration without using peer2peer flag"));
+            virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
+                            _("cannot perform tunnelled migration without "
+                              "using peer2peer flag"));
             goto error;
         }
 
@@ -3526,7 +3331,7 @@ virDomainMigrate (virDomainPtr domain,
             ddomain = virDomainMigrateVersion2(domain, dconn, flags, dname, uri, bandwidth);
         else {
             /* This driver does not support any migration method */
-            virLibConnError(domain->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+            virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
             goto error;
         }
     }
@@ -3613,17 +3418,17 @@ virDomainMigrateToURI (virDomainPtr domain,
 
     /* First checkout the source */
     if (!VIR_IS_CONNECTED_DOMAIN (domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
     if (duri == NULL) {
-        virLibConnError (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3634,7 +3439,7 @@ virDomainMigrateToURI (virDomainPtr domain,
                 goto error;
         } else {
             /* No peer to peer migration supported */
-            virLibConnError (domain->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+            virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
             goto error;
         }
     } else {
@@ -3644,7 +3449,7 @@ virDomainMigrateToURI (virDomainPtr domain,
                 goto error;
         } else {
             /* Cannot do a migration with only the perform step */
-            virLibConnError (domain->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+            virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
             goto error;
         }
     }
@@ -3678,13 +3483,13 @@ virDomainMigratePrepare (virConnectPtr dconn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT (dconn)) {
-        virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if (dconn->flags & VIR_CONNECT_RO) {
-        virLibConnError(dconn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3698,7 +3503,7 @@ virDomainMigratePrepare (virConnectPtr dconn,
         return ret;
     }
 
-    virLibConnError (dconn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dconn);
@@ -3726,14 +3531,14 @@ virDomainMigratePerform (virDomainPtr domain,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN (domain)) {
-        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     conn = domain->conn;
 
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3747,7 +3552,7 @@ virDomainMigratePerform (virDomainPtr domain,
         return ret;
     }
 
-    virLibDomainError (domain, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibDomainError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -3773,13 +3578,13 @@ virDomainMigrateFinish (virConnectPtr dconn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT (dconn)) {
-        virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
 
     if (dconn->flags & VIR_CONNECT_RO) {
-        virLibConnError(dconn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3793,7 +3598,7 @@ virDomainMigrateFinish (virConnectPtr dconn,
         return ret;
     }
 
-    virLibConnError (dconn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dconn);
@@ -3824,13 +3629,13 @@ virDomainMigratePrepare2 (virConnectPtr dconn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT (dconn)) {
-        virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if (dconn->flags & VIR_CONNECT_RO) {
-        virLibConnError(dconn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3845,7 +3650,7 @@ virDomainMigratePrepare2 (virConnectPtr dconn,
         return ret;
     }
 
-    virLibConnError (dconn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dconn);
@@ -3872,13 +3677,13 @@ virDomainMigrateFinish2 (virConnectPtr dconn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT (dconn)) {
-        virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
 
     if (dconn->flags & VIR_CONNECT_RO) {
-        virLibConnError(dconn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3893,7 +3698,7 @@ virDomainMigrateFinish2 (virConnectPtr dconn,
         return ret;
     }
 
-    virLibConnError (dconn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dconn);
@@ -3921,18 +3726,18 @@ virDomainMigratePrepareTunnel(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
     if (conn != st->conn) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3945,7 +3750,7 @@ virDomainMigratePrepareTunnel(virConnectPtr conn,
         return rv;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -3970,12 +3775,12 @@ virNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (info == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -3987,7 +3792,7 @@ virNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -4012,7 +3817,7 @@ virConnectGetCapabilities (virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT (conn)) {
-        virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -4025,7 +3830,7 @@ virConnectGetCapabilities (virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -4050,7 +3855,7 @@ virNodeGetFreeMemory(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT (conn)) {
-        virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return 0;
     }
@@ -4063,7 +3868,7 @@ virNodeGetFreeMemory(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -4089,7 +3894,7 @@ virDomainGetSchedulerType(virDomainPtr domain, int *nparams)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -4102,7 +3907,7 @@ virDomainGetSchedulerType(virDomainPtr domain, int *nparams)
         return schedtype;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -4134,7 +3939,7 @@ virDomainGetSchedulerParameters(virDomainPtr domain,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -4148,7 +3953,7 @@ virDomainGetSchedulerParameters(virDomainPtr domain,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -4177,12 +3982,12 @@ virDomainSetSchedulerParameters(virDomainPtr domain,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
@@ -4195,7 +4000,7 @@ virDomainSetSchedulerParameters(virDomainPtr domain,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -4237,12 +4042,12 @@ virDomainBlockStats (virDomainPtr dom, const char *path,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
-        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     if (!path || !stats || size > sizeof stats2) {
-        virLibDomainError (dom, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     conn = dom->conn;
@@ -4255,7 +4060,7 @@ virDomainBlockStats (virDomainPtr dom, const char *path,
         return 0;
     }
 
-    virLibDomainError (dom, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibDomainError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dom->conn);
@@ -4295,12 +4100,12 @@ virDomainInterfaceStats (virDomainPtr dom, const char *path,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
-        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     if (!path || !stats || size > sizeof stats2) {
-        virLibDomainError (dom, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     conn = dom->conn;
@@ -4313,7 +4118,7 @@ virDomainInterfaceStats (virDomainPtr dom, const char *path,
         return 0;
     }
 
-    virLibDomainError (dom, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibDomainError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dom->conn);
@@ -4358,15 +4163,15 @@ int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats,
     DEBUG("domain=%p, stats=%p, nr_stats=%u", dom, stats, nr_stats);
 
     if (flags != 0) {
-        virLibDomainError (dom, VIR_ERR_INVALID_ARG,
-                           _("flags must be zero"));
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s",
+                          _("flags must be zero"));
         goto error;
     }
 
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
-        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -4384,7 +4189,7 @@ int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats,
         return nr_stats_ret;
     }
 
-    virLibDomainError (dom, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibDomainError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dom->conn);
@@ -4445,33 +4250,30 @@ virDomainBlockPeek (virDomainPtr dom,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
-        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     conn = dom->conn;
 
     if (dom->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(dom, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
     if (!path) {
-        virLibDomainError (dom, VIR_ERR_INVALID_ARG,
-                           _("path is NULL"));
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", _("path is NULL"));
         goto error;
     }
 
     if (flags != 0) {
-        virLibDomainError (dom, VIR_ERR_INVALID_ARG,
-                           _("flags must be zero"));
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", _("flags must be zero"));
         goto error;
     }
 
     /* Allow size == 0 as an access test. */
     if (size > 0 && !buffer) {
-        virLibDomainError (dom, VIR_ERR_INVALID_ARG,
-                           _("buffer is NULL"));
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", _("buffer is NULL"));
         goto error;
     }
 
@@ -4484,7 +4286,7 @@ virDomainBlockPeek (virDomainPtr dom,
         return ret;
     }
 
-    virLibDomainError (dom, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibDomainError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dom->conn);
@@ -4536,14 +4338,14 @@ virDomainMemoryPeek (virDomainPtr dom,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
-        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     conn = dom->conn;
 
     if (dom->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(dom, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -4571,15 +4373,16 @@ virDomainMemoryPeek (virDomainPtr dom,
      */
 
     if (flags != VIR_MEMORY_VIRTUAL && flags != VIR_MEMORY_PHYSICAL) {
-        virLibDomainError (dom, VIR_ERR_INVALID_ARG,
-                     _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s",
+                          _("flags parameter must be VIR_MEMORY_VIRTUAL or "
+                            "VIR_MEMORY_PHYSICAL"));
         goto error;
     }
 
     /* Allow size == 0 as an access test. */
     if (size > 0 && !buffer) {
-        virLibDomainError (dom, VIR_ERR_INVALID_ARG,
-                           _("buffer is NULL but size is non-zero"));
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s",
+                          _("buffer is NULL but size is non-zero"));
         goto error;
     }
 
@@ -4592,7 +4395,7 @@ virDomainMemoryPeek (virDomainPtr dom,
         return ret;
     }
 
-    virLibDomainError (dom, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibDomainError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dom->conn);
@@ -4625,16 +4428,16 @@ virDomainDefineXML(virConnectPtr conn, const char *xml) {
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (xml == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -4646,7 +4449,7 @@ virDomainDefineXML(virConnectPtr conn, const char *xml) {
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -4669,13 +4472,13 @@ virDomainUndefine(virDomainPtr domain) {
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     conn = domain->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -4687,7 +4490,7 @@ virDomainUndefine(virDomainPtr domain) {
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -4710,7 +4513,7 @@ virConnectNumOfDefinedDomains(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -4723,7 +4526,7 @@ virConnectNumOfDefinedDomains(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -4749,13 +4552,13 @@ virConnectListDefinedDomains(virConnectPtr conn, char **const names,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if ((names == NULL) || (maxnames < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -4767,7 +4570,7 @@ virConnectListDefinedDomains(virConnectPtr conn, char **const names,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -4791,13 +4594,13 @@ virDomainCreate(virDomainPtr domain) {
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     conn = domain->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -4809,7 +4612,7 @@ virDomainCreate(virDomainPtr domain) {
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -4837,12 +4640,12 @@ virDomainGetAutostart(virDomainPtr domain,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (!autostart) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -4856,7 +4659,7 @@ virDomainGetAutostart(virDomainPtr domain,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -4883,7 +4686,7 @@ virDomainSetAutostart(virDomainPtr domain,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -4891,7 +4694,7 @@ virDomainSetAutostart(virDomainPtr domain,
     conn = domain->conn;
 
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -4903,7 +4706,7 @@ virDomainSetAutostart(virDomainPtr domain,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -4935,17 +4738,17 @@ virDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
     if (nvcpus < 1) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
@@ -4958,7 +4761,7 @@ virDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -4996,17 +4799,17 @@ virDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
     if ((vcpu > 32000) || (cpumap == NULL) || (maplen < 1)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
        goto error;
     }
 
@@ -5020,7 +4823,7 @@ virDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -5059,12 +4862,12 @@ virDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if ((info == NULL) || (maxinfo < 1)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5072,7 +4875,7 @@ virDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
        try to memcpy anything into a NULL pointer.  */
     if ((cpumaps == NULL && maplen != 0)
         || (cpumaps && maplen <= 0)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5087,7 +4890,7 @@ virDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -5115,7 +4918,7 @@ virDomainGetMaxVcpus(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -5130,7 +4933,7 @@ virDomainGetMaxVcpus(virDomainPtr domain)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -5154,13 +4957,13 @@ virDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel)
     virConnectPtr conn;
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if (seclabel == NULL) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5174,7 +4977,7 @@ virDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -5196,13 +4999,13 @@ int
 virNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel)
 {
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if (secmodel == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5214,7 +5017,7 @@ virNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5244,12 +5047,12 @@ virDomainAttachDevice(virDomainPtr domain, const char *xml)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
@@ -5262,7 +5065,7 @@ virDomainAttachDevice(virDomainPtr domain, const char *xml)
        return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -5303,11 +5106,12 @@ virDomainAttachDeviceFlags(virDomainPtr domain,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
+        virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
@@ -5320,7 +5124,7 @@ virDomainAttachDeviceFlags(virDomainPtr domain,
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -5346,12 +5150,12 @@ virDomainDetachDevice(virDomainPtr domain, const char *xml)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
@@ -5364,7 +5168,7 @@ virDomainDetachDevice(virDomainPtr domain, const char *xml)
          return ret;
      }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -5401,11 +5205,11 @@ virDomainDetachDeviceFlags(virDomainPtr domain,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
@@ -5418,7 +5222,7 @@ virDomainDetachDeviceFlags(virDomainPtr domain,
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -5459,11 +5263,12 @@ virDomainUpdateDeviceFlags(virDomainPtr domain,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
+        virDispatchError(NULL);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     conn = domain->conn;
@@ -5476,7 +5281,7 @@ virDomainUpdateDeviceFlags(virDomainPtr domain,
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -5511,13 +5316,13 @@ virNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if ((freeMems == NULL) || (maxCells <= 0) || (startCell < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5529,7 +5334,7 @@ virNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5558,7 +5363,7 @@ virNetworkGetConnect (virNetworkPtr net)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK (net)) {
-        virLibNetworkError (NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -5581,7 +5386,7 @@ virConnectNumOfNetworks(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -5594,7 +5399,7 @@ virConnectNumOfNetworks(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5619,13 +5424,13 @@ virConnectListNetworks(virConnectPtr conn, char **const names, int maxnames)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if ((names == NULL) || (maxnames < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5637,7 +5442,7 @@ virConnectListNetworks(virConnectPtr conn, char **const names, int maxnames)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5660,7 +5465,7 @@ virConnectNumOfDefinedNetworks(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -5673,7 +5478,7 @@ virConnectNumOfDefinedNetworks(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5699,13 +5504,13 @@ virConnectListDefinedNetworks(virConnectPtr conn, char **const names,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if ((names == NULL) || (maxnames < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5718,7 +5523,7 @@ virConnectListDefinedNetworks(virConnectPtr conn, char **const names,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5743,12 +5548,12 @@ virNetworkLookupByName(virConnectPtr conn, const char *name)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (name == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto  error;
     }
 
@@ -5760,7 +5565,7 @@ virNetworkLookupByName(virConnectPtr conn, const char *name)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5785,12 +5590,12 @@ virNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuid == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5802,7 +5607,7 @@ virNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5828,17 +5633,17 @@ virNetworkLookupByUUIDString(virConnectPtr conn, const char *uuidstr)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuidstr == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
     if (virUUIDParse(uuidstr, uuid) < 0) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5867,16 +5672,16 @@ virNetworkCreateXML(virConnectPtr conn, const char *xmlDesc)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (xmlDesc == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5888,7 +5693,7 @@ virNetworkCreateXML(virConnectPtr conn, const char *xmlDesc)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5912,16 +5717,16 @@ virNetworkDefineXML(virConnectPtr conn, const char *xml)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (xml == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5933,7 +5738,7 @@ virNetworkDefineXML(virConnectPtr conn, const char *xml)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -5956,13 +5761,13 @@ virNetworkUndefine(virNetworkPtr network) {
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     conn = network->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibNetworkError(network, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -5974,7 +5779,7 @@ virNetworkUndefine(virNetworkPtr network) {
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(network->conn);
@@ -5999,13 +5804,13 @@ virNetworkCreate(virNetworkPtr network)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     conn = network->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibNetworkError(network, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6017,7 +5822,7 @@ virNetworkCreate(virNetworkPtr network)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(network->conn);
@@ -6044,14 +5849,14 @@ virNetworkDestroy(virNetworkPtr network)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     conn = network->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibNetworkError(network, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6063,7 +5868,7 @@ virNetworkDestroy(virNetworkPtr network)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(network->conn);
@@ -6087,7 +5892,7 @@ virNetworkFree(virNetworkPtr network)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -6119,7 +5924,7 @@ int
 virNetworkRef(virNetworkPtr network)
 {
     if ((!VIR_IS_CONNECTED_NETWORK(network))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return(-1);
     }
@@ -6147,7 +5952,7 @@ virNetworkGetName(virNetworkPtr network)
     virResetLastError();
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -6171,12 +5976,12 @@ virNetworkGetUUID(virNetworkPtr network, unsigned char *uuid)
     virResetLastError();
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (uuid == NULL) {
-        virLibNetworkError(network, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6208,12 +6013,12 @@ virNetworkGetUUIDString(virNetworkPtr network, char *buf)
     virResetLastError();
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (buf == NULL) {
-        virLibNetworkError(network, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6248,12 +6053,12 @@ virNetworkGetXMLDesc(virNetworkPtr network, int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (flags != 0) {
-        virLibNetworkError(network, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6267,7 +6072,7 @@ virNetworkGetXMLDesc(virNetworkPtr network, int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(network->conn);
@@ -6293,7 +6098,7 @@ virNetworkGetBridgeName(virNetworkPtr network)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -6308,7 +6113,7 @@ virNetworkGetBridgeName(virNetworkPtr network)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(network->conn);
@@ -6336,12 +6141,12 @@ virNetworkGetAutostart(virNetworkPtr network,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (!autostart) {
-        virLibNetworkError(network, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6355,7 +6160,7 @@ virNetworkGetAutostart(virNetworkPtr network,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(network->conn);
@@ -6382,13 +6187,13 @@ virNetworkSetAutostart(virNetworkPtr network,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if (network->conn->flags & VIR_CONNECT_RO) {
-        virLibNetworkError(network, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibNetworkError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6402,7 +6207,7 @@ virNetworkSetAutostart(virNetworkPtr network,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(network->conn);
@@ -6431,7 +6236,7 @@ virInterfaceGetConnect (virInterfacePtr iface)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_INTERFACE (iface)) {
-        virLibInterfaceError (NULL, VIR_ERR_INVALID_INTERFACE, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_INVALID_INTERFACE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -6454,7 +6259,7 @@ virConnectNumOfInterfaces(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -6467,7 +6272,7 @@ virConnectNumOfInterfaces(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -6493,13 +6298,13 @@ virConnectListInterfaces(virConnectPtr conn, char **const names, int maxnames)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if ((names == NULL) || (maxnames < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6511,7 +6316,7 @@ virConnectListInterfaces(virConnectPtr conn, char **const names, int maxnames)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -6534,7 +6339,7 @@ virConnectNumOfDefinedInterfaces(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -6547,7 +6352,7 @@ virConnectNumOfDefinedInterfaces(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -6575,13 +6380,13 @@ virConnectListDefinedInterfaces(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if ((names == NULL) || (maxnames < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6593,7 +6398,7 @@ virConnectListDefinedInterfaces(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -6618,12 +6423,12 @@ virInterfaceLookupByName(virConnectPtr conn, const char *name)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (name == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto  error;
     }
 
@@ -6635,7 +6440,7 @@ virInterfaceLookupByName(virConnectPtr conn, const char *name)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -6660,12 +6465,12 @@ virInterfaceLookupByMACString(virConnectPtr conn, const char *macstr)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (macstr == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto  error;
     }
 
@@ -6677,7 +6482,7 @@ virInterfaceLookupByMACString(virConnectPtr conn, const char *macstr)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -6701,7 +6506,7 @@ virInterfaceGetName(virInterfacePtr iface)
     virResetLastError();
 
     if (!VIR_IS_INTERFACE(iface)) {
-        virLibInterfaceError(NULL, VIR_ERR_INVALID_INTERFACE, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_INVALID_INTERFACE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -6727,7 +6532,7 @@ virInterfaceGetMACString(virInterfacePtr iface)
     virResetLastError();
 
     if (!VIR_IS_INTERFACE(iface)) {
-        virLibInterfaceError(NULL, VIR_ERR_INVALID_INTERFACE, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_INVALID_INTERFACE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -6761,12 +6566,12 @@ virInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
-        virLibInterfaceError(NULL, VIR_ERR_INVALID_INTERFACE, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_INVALID_INTERFACE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if ((flags & ~VIR_INTERFACE_XML_INACTIVE) != 0) {
-        virLibInterfaceError(iface, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6780,7 +6585,7 @@ virInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(iface->conn);
@@ -6805,16 +6610,16 @@ virInterfaceDefineXML(virConnectPtr conn, const char *xml, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (xml == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6826,7 +6631,7 @@ virInterfaceDefineXML(virConnectPtr conn, const char *xml, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -6850,13 +6655,13 @@ virInterfaceUndefine(virInterfacePtr iface) {
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
-        virLibInterfaceError(NULL, VIR_ERR_INVALID_INTERFACE, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_INVALID_INTERFACE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     conn = iface->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibInterfaceError(iface, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6868,7 +6673,7 @@ virInterfaceUndefine(virInterfacePtr iface) {
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(iface->conn);
@@ -6893,13 +6698,13 @@ virInterfaceCreate(virInterfacePtr iface, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
-        virLibInterfaceError(NULL, VIR_ERR_INVALID_INTERFACE, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_INVALID_INTERFACE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     conn = iface->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibInterfaceError(iface, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6911,7 +6716,7 @@ virInterfaceCreate(virInterfacePtr iface, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(iface->conn);
@@ -6938,14 +6743,14 @@ virInterfaceDestroy(virInterfacePtr iface, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
-        virLibInterfaceError(NULL, VIR_ERR_INVALID_INTERFACE, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_INVALID_INTERFACE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     conn = iface->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibInterfaceError(iface, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -6957,7 +6762,7 @@ virInterfaceDestroy(virInterfacePtr iface, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(iface->conn);
@@ -6985,7 +6790,7 @@ int
 virInterfaceRef(virInterfacePtr iface)
 {
     if ((!VIR_IS_CONNECTED_INTERFACE(iface))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return(-1);
     }
@@ -7013,7 +6818,7 @@ virInterfaceFree(virInterfacePtr iface)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
-        virLibInterfaceError(NULL, VIR_ERR_INVALID_INTERFACE, __FUNCTION__);
+        virLibInterfaceError(VIR_ERR_INVALID_INTERFACE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -7047,7 +6852,7 @@ virStoragePoolGetConnect (virStoragePoolPtr pool)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL (pool)) {
-        virLibStoragePoolError (NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -7070,7 +6875,7 @@ virConnectNumOfStoragePools	(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -7083,7 +6888,7 @@ virConnectNumOfStoragePools	(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -7112,13 +6917,13 @@ virConnectListStoragePools	(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if ((names == NULL) || (maxnames < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7130,7 +6935,7 @@ virConnectListStoragePools	(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -7154,7 +6959,7 @@ virConnectNumOfDefinedStoragePools(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -7167,7 +6972,7 @@ virConnectNumOfDefinedStoragePools(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -7197,13 +7002,13 @@ virConnectListDefinedStoragePools(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if ((names == NULL) || (maxnames < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7215,7 +7020,7 @@ virConnectListDefinedStoragePools(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -7255,17 +7060,17 @@ virConnectFindStoragePoolSources(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
     if (type == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7277,7 +7082,7 @@ virConnectFindStoragePoolSources(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -7303,12 +7108,12 @@ virStoragePoolLookupByName(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (name == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7320,7 +7125,7 @@ virStoragePoolLookupByName(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -7346,12 +7151,12 @@ virStoragePoolLookupByUUID(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuid == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7363,7 +7168,7 @@ virStoragePoolLookupByUUID(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -7390,17 +7195,17 @@ virStoragePoolLookupByUUIDString(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuidstr == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
     if (virUUIDParse(uuidstr, uuid) < 0) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7428,7 +7233,7 @@ virStoragePoolLookupByVolume(virStorageVolPtr vol)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_VOL(vol)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -7441,7 +7246,7 @@ virStoragePoolLookupByVolume(virStorageVolPtr vol)
         return ret;
     }
 
-    virLibConnError (vol->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(vol->conn);
@@ -7470,16 +7275,16 @@ virStoragePoolCreateXML(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (xmlDesc == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7491,7 +7296,7 @@ virStoragePoolCreateXML(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -7519,16 +7324,16 @@ virStoragePoolDefineXML(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (xml == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7540,7 +7345,7 @@ virStoragePoolDefineXML(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -7566,13 +7371,13 @@ virStoragePoolBuild(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     conn = pool->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibStoragePoolError(pool, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7584,7 +7389,7 @@ virStoragePoolBuild(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -7609,13 +7414,13 @@ virStoragePoolUndefine(virStoragePoolPtr pool)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_NETWORK, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     conn = pool->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibStoragePoolError(pool, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7627,7 +7432,7 @@ virStoragePoolUndefine(virStoragePoolPtr pool)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -7654,13 +7459,13 @@ virStoragePoolCreate(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     conn = pool->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibStoragePoolError(pool, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7672,7 +7477,7 @@ virStoragePoolCreate(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -7701,14 +7506,14 @@ virStoragePoolDestroy(virStoragePoolPtr pool)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     conn = pool->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibStoragePoolError(pool, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7720,7 +7525,7 @@ virStoragePoolDestroy(virStoragePoolPtr pool)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -7748,14 +7553,14 @@ virStoragePoolDelete(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     conn = pool->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibStoragePoolError(pool, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7767,7 +7572,7 @@ virStoragePoolDelete(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -7792,7 +7597,7 @@ virStoragePoolFree(virStoragePoolPtr pool)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -7826,7 +7631,7 @@ int
 virStoragePoolRef(virStoragePoolPtr pool)
 {
     if ((!VIR_IS_CONNECTED_STORAGE_POOL(pool))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return(-1);
     }
@@ -7858,14 +7663,14 @@ virStoragePoolRefresh(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     conn = pool->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibStoragePoolError(pool, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7877,7 +7682,7 @@ virStoragePoolRefresh(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -7901,7 +7706,7 @@ virStoragePoolGetName(virStoragePoolPtr pool)
     virResetLastError();
 
     if (!VIR_IS_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -7927,12 +7732,12 @@ virStoragePoolGetUUID(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (uuid == NULL) {
-        virLibStoragePoolError(pool, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -7964,12 +7769,12 @@ virStoragePoolGetUUIDString(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (buf == NULL) {
-        virLibStoragePoolError(pool, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8005,12 +7810,12 @@ virStoragePoolGetInfo(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (info == NULL) {
-        virLibStoragePoolError(pool, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8026,7 +7831,7 @@ virStoragePoolGetInfo(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -8055,12 +7860,12 @@ virStoragePoolGetXMLDesc(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (flags != 0) {
-        virLibStoragePoolError(pool, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8074,7 +7879,7 @@ virStoragePoolGetXMLDesc(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -8102,12 +7907,12 @@ virStoragePoolGetAutostart(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (!autostart) {
-        virLibStoragePoolError(pool, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8121,7 +7926,7 @@ virStoragePoolGetAutostart(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -8148,13 +7953,13 @@ virStoragePoolSetAutostart(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibStoragePoolError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if (pool->conn->flags & VIR_CONNECT_RO) {
-        virLibStoragePoolError(pool, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8168,7 +7973,7 @@ virStoragePoolSetAutostart(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -8192,7 +7997,7 @@ virStoragePoolNumOfVolumes(virStoragePoolPtr pool)
     virResetLastError();
 
     if (!VIR_IS_STORAGE_POOL(pool)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -8205,7 +8010,7 @@ virStoragePoolNumOfVolumes(virStoragePoolPtr pool)
         return ret;
     }
 
-    virLibConnError (pool->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -8234,13 +8039,13 @@ virStoragePoolListVolumes(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_STORAGE_POOL(pool)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if ((names == NULL) || (maxnames < 0)) {
-        virLibConnError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8252,7 +8057,7 @@ virStoragePoolListVolumes(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (pool->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -8282,7 +8087,7 @@ virStorageVolGetConnect (virStorageVolPtr vol)
     virResetLastError();
 
     if (!VIR_IS_STORAGE_VOL (vol)) {
-        virLibStoragePoolError (NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -8309,12 +8114,12 @@ virStorageVolLookupByName(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_STORAGE_POOL(pool)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (name == NULL) {
-        virLibConnError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8326,7 +8131,7 @@ virStorageVolLookupByName(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (pool->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -8354,12 +8159,12 @@ virStorageVolLookupByKey(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (key == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8371,7 +8176,7 @@ virStorageVolLookupByKey(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -8397,12 +8202,12 @@ virStorageVolLookupByPath(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (path == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8414,7 +8219,7 @@ virStorageVolLookupByPath(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -8439,7 +8244,7 @@ virStorageVolGetName(virStorageVolPtr vol)
     virResetLastError();
 
     if (!VIR_IS_STORAGE_VOL(vol)) {
-        virLibStorageVolError(NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -8465,7 +8270,7 @@ virStorageVolGetKey(virStorageVolPtr vol)
     virResetLastError();
 
     if (!VIR_IS_STORAGE_VOL(vol)) {
-        virLibStorageVolError(NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -8495,13 +8300,13 @@ virStorageVolCreateXML(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_STORAGE_POOL(pool)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
 
     if (pool->conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(pool->conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8513,7 +8318,7 @@ virStorageVolCreateXML(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (pool->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -8546,19 +8351,19 @@ virStorageVolCreateXMLFrom(virStoragePoolPtr pool,
     virResetLastError();
 
     if (!VIR_IS_STORAGE_POOL(pool)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_STORAGE_POOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
 
     if (!VIR_IS_STORAGE_VOL(clonevol)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         goto error;
     }
 
     if (pool->conn->flags & VIR_CONNECT_RO ||
         clonevol->conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(pool->conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8572,7 +8377,7 @@ virStorageVolCreateXMLFrom(virStoragePoolPtr pool,
         return ret;
     }
 
-    virLibConnError (pool->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(pool->conn);
@@ -8599,14 +8404,14 @@ virStorageVolDelete(virStorageVolPtr vol,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_VOL(vol)) {
-        virLibStorageVolError(NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     conn = vol->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibStorageVolError(vol, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8618,7 +8423,7 @@ virStorageVolDelete(virStorageVolPtr vol,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(vol->conn);
@@ -8645,14 +8450,14 @@ virStorageVolWipe(virStorageVolPtr vol,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_VOL(vol)) {
-        virLibStorageVolError(NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     conn = vol->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibStorageVolError(vol, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8665,7 +8470,7 @@ virStorageVolWipe(virStorageVolPtr vol,
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(vol->conn);
@@ -8690,7 +8495,7 @@ virStorageVolFree(virStorageVolPtr vol)
     virResetLastError();
 
     if (!VIR_IS_STORAGE_VOL(vol)) {
-        virLibStorageVolError(NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -8723,7 +8528,7 @@ int
 virStorageVolRef(virStorageVolPtr vol)
 {
     if ((!VIR_IS_CONNECTED_STORAGE_VOL(vol))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return(-1);
     }
@@ -8754,12 +8559,12 @@ virStorageVolGetInfo(virStorageVolPtr vol,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_VOL(vol)) {
-        virLibStorageVolError(NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (info == NULL) {
-        virLibStorageVolError(vol, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8775,7 +8580,7 @@ virStorageVolGetInfo(virStorageVolPtr vol,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(vol->conn);
@@ -8803,12 +8608,12 @@ virStorageVolGetXMLDesc(virStorageVolPtr vol,
     virResetLastError();
 
     if (!VIR_IS_STORAGE_VOL(vol)) {
-        virLibStorageVolError(NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (flags != 0) {
-        virLibStorageVolError(vol, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8822,7 +8627,7 @@ virStorageVolGetXMLDesc(virStorageVolPtr vol,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(vol->conn);
@@ -8851,7 +8656,7 @@ virStorageVolGetPath(virStorageVolPtr vol)
     virResetLastError();
 
     if (!VIR_IS_STORAGE_VOL(vol)) {
-        virLibStorageVolError(NULL, VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__);
+        virLibStorageVolError(VIR_ERR_INVALID_STORAGE_VOL, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -8866,7 +8671,7 @@ virStorageVolGetPath(virStorageVolPtr vol)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(vol->conn);
@@ -8895,12 +8700,12 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (flags != 0) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8912,7 +8717,7 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -8947,12 +8752,12 @@ virNodeListDevices(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if ((flags != 0) || (names == NULL) || (maxnames < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -8964,7 +8769,7 @@ virNodeListDevices(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -8988,13 +8793,13 @@ virNodeDevicePtr virNodeDeviceLookupByName(virConnectPtr conn, const char *name)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
 
     if (name == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9006,7 +8811,7 @@ virNodeDevicePtr virNodeDeviceLookupByName(virConnectPtr conn, const char *name)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -9031,7 +8836,7 @@ char *virNodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -9044,7 +8849,7 @@ char *virNodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (dev->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dev->conn);
@@ -9065,7 +8870,7 @@ const char *virNodeDeviceGetName(virNodeDevicePtr dev)
     DEBUG("dev=%p, conn=%p", dev, dev ? dev->conn : NULL);
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -9089,7 +8894,7 @@ const char *virNodeDeviceGetParent(virNodeDevicePtr dev)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -9098,7 +8903,7 @@ const char *virNodeDeviceGetParent(virNodeDevicePtr dev)
         if (dev->conn->deviceMonitor && dev->conn->deviceMonitor->deviceGetParent) {
             dev->parent = dev->conn->deviceMonitor->deviceGetParent (dev);
         } else {
-            virLibConnError (dev->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+            virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
             virDispatchError(dev->conn);
             return NULL;
         }
@@ -9121,7 +8926,7 @@ int virNodeDeviceNumOfCaps(virNodeDevicePtr dev)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -9134,7 +8939,7 @@ int virNodeDeviceNumOfCaps(virNodeDevicePtr dev)
         return ret;
     }
 
-    virLibConnError (dev->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dev->conn);
@@ -9161,7 +8966,7 @@ int virNodeDeviceListCaps(virNodeDevicePtr dev,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -9174,7 +8979,7 @@ int virNodeDeviceListCaps(virNodeDevicePtr dev,
         return ret;
     }
 
-    virLibConnError (dev->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dev->conn);
@@ -9198,7 +9003,7 @@ int virNodeDeviceFree(virNodeDevicePtr dev)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -9231,7 +9036,7 @@ int
 virNodeDeviceRef(virNodeDevicePtr dev)
 {
     if ((!VIR_IS_CONNECTED_NODE_DEVICE(dev))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return(-1);
     }
@@ -9269,7 +9074,7 @@ virNodeDeviceDettach(virNodeDevicePtr dev)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -9282,7 +9087,7 @@ virNodeDeviceDettach(virNodeDevicePtr dev)
         return ret;
     }
 
-    virLibConnError(dev->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dev->conn);
@@ -9312,7 +9117,7 @@ virNodeDeviceReAttach(virNodeDevicePtr dev)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -9325,7 +9130,7 @@ virNodeDeviceReAttach(virNodeDevicePtr dev)
         return ret;
     }
 
-    virLibConnError(dev->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dev->conn);
@@ -9357,7 +9162,7 @@ virNodeDeviceReset(virNodeDevicePtr dev)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -9370,7 +9175,7 @@ virNodeDeviceReset(virNodeDevicePtr dev)
         return ret;
     }
 
-    virLibConnError(dev->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dev->conn);
@@ -9399,18 +9204,18 @@ virNodeDeviceCreateXML(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
 
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
     if (xmlDesc == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9422,7 +9227,7 @@ virNodeDeviceCreateXML(virConnectPtr conn,
         return dev;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -9447,13 +9252,13 @@ virNodeDeviceDestroy(virNodeDevicePtr dev)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
-        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
+        virLibNodeDeviceError(VIR_ERR_INVALID_NODE_DEVICE, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if (dev->conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(dev->conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9467,7 +9272,7 @@ virNodeDeviceDestroy(virNodeDevicePtr dev)
         return 0;
     }
 
-    virLibConnError (dev->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(dev->conn);
@@ -9512,12 +9317,12 @@ virConnectDomainEventRegister(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (cb == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9529,7 +9334,7 @@ virConnectDomainEventRegister(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 error:
     virDispatchError(conn);
     return -1;
@@ -9558,12 +9363,12 @@ virConnectDomainEventDeregister(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (cb == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     if ((conn->driver) && (conn->driver->domainEventDeregister)) {
@@ -9574,7 +9379,7 @@ virConnectDomainEventDeregister(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 error:
     virDispatchError(conn);
     return -1;
@@ -9600,7 +9405,7 @@ virSecretGetConnect (virSecretPtr secret)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_SECRET (secret)) {
-        virLibSecretError (NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -9623,7 +9428,7 @@ virConnectNumOfSecrets(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -9638,7 +9443,7 @@ virConnectNumOfSecrets(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -9663,12 +9468,12 @@ virConnectListSecrets(virConnectPtr conn, char **uuids, int maxuuids)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     if (uuids == NULL || maxuuids < 0) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9681,7 +9486,7 @@ virConnectListSecrets(virConnectPtr conn, char **uuids, int maxuuids)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -9707,12 +9512,12 @@ virSecretLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuid == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9725,7 +9530,7 @@ virSecretLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -9752,17 +9557,17 @@ virSecretLookupByUUIDString(virConnectPtr conn, const char *uuidstr)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuidstr == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
     if (virUUIDParse(uuidstr, uuid) < 0) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9797,12 +9602,12 @@ virSecretLookupByUsage(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (usageID == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9815,7 +9620,7 @@ virSecretLookupByUsage(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -9846,16 +9651,16 @@ virSecretDefineXML(virConnectPtr conn, const char *xml, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (xml == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9868,7 +9673,7 @@ virSecretDefineXML(virConnectPtr conn, const char *xml, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -9893,12 +9698,12 @@ virSecretGetUUID(virSecretPtr secret, unsigned char *uuid)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     if (uuid == NULL) {
-        virLibSecretError(secret, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(secret->conn);
         return -1;
     }
@@ -9927,12 +9732,12 @@ virSecretGetUUIDString(virSecretPtr secret, char *buf)
     virResetLastError();
 
     if (!VIR_IS_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (buf == NULL) {
-        virLibSecretError(secret, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -9968,7 +9773,7 @@ virSecretGetUsageType(virSecretPtr secret)
     virResetLastError();
 
     if (!VIR_IS_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -9999,7 +9804,7 @@ virSecretGetUsageID(virSecretPtr secret)
     virResetLastError();
 
     if (!VIR_IS_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -10027,7 +9832,7 @@ virSecretGetXMLDesc(virSecretPtr secret, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
@@ -10042,7 +9847,7 @@ virSecretGetXMLDesc(virSecretPtr secret, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -10072,17 +9877,17 @@ virSecretSetValue(virSecretPtr secret, const unsigned char *value,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     conn = secret->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibSecretError(secret, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibSecretError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (value == NULL) {
-        virLibSecretError(secret, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -10095,7 +9900,7 @@ virSecretSetValue(virSecretPtr secret, const unsigned char *value,
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -10123,17 +9928,17 @@ virSecretGetValue(virSecretPtr secret, size_t *value_size, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
     conn = secret->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibSecretError(secret, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibSecretError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
     if (value_size == NULL) {
-        virLibSecretError(secret, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -10148,7 +9953,7 @@ virSecretGetValue(virSecretPtr secret, size_t *value_size, unsigned int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -10174,13 +9979,13 @@ virSecretUndefine(virSecretPtr secret)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     conn = secret->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibSecretError(secret, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibSecretError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -10193,7 +9998,7 @@ virSecretUndefine(virSecretPtr secret)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -10220,7 +10025,7 @@ int
 virSecretRef(virSecretPtr secret)
 {
     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -10247,7 +10052,7 @@ virSecretFree(virSecretPtr secret)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__);
+        virLibSecretError(VIR_ERR_INVALID_SECRET, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -10289,7 +10094,7 @@ virStreamNew(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -10317,7 +10122,7 @@ int
 virStreamRef(virStreamPtr stream)
 {
     if ((!VIR_IS_CONNECTED_STREAM(stream))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return(-1);
     }
@@ -10402,7 +10207,7 @@ int virStreamSend(virStreamPtr stream,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -10418,7 +10223,7 @@ int virStreamSend(virStreamPtr stream,
         return ret;
     }
 
-    virLibConnError(stream->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(stream->conn);
@@ -10497,7 +10302,7 @@ int virStreamRecv(virStreamPtr stream,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -10513,7 +10318,7 @@ int virStreamRecv(virStreamPtr stream,
         return ret;
     }
 
-    virLibConnError(stream->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(stream->conn);
@@ -10573,13 +10378,13 @@ int virStreamSendAll(virStreamPtr stream,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if (stream->flags & VIR_STREAM_NONBLOCK) {
-        virLibConnError(NULL, VIR_ERR_OPERATION_INVALID,
+        virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
                         _("data sources cannot be used for non-blocking streams"));
         goto cleanup;
     }
@@ -10670,13 +10475,13 @@ int virStreamRecvAll(virStreamPtr stream,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     if (stream->flags & VIR_STREAM_NONBLOCK) {
-        virLibConnError(NULL, VIR_ERR_OPERATION_INVALID,
+        virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
                         _("data sinks cannot be used for non-blocking streams"));
         goto cleanup;
     }
@@ -10742,7 +10547,7 @@ int virStreamEventAddCallback(virStreamPtr stream,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -10756,7 +10561,7 @@ int virStreamEventAddCallback(virStreamPtr stream,
         return ret;
     }
 
-    virLibConnError(stream->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(stream->conn);
@@ -10784,7 +10589,7 @@ int virStreamEventUpdateCallback(virStreamPtr stream,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -10798,7 +10603,7 @@ int virStreamEventUpdateCallback(virStreamPtr stream,
         return ret;
     }
 
-    virLibConnError (stream->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(stream->conn);
@@ -10820,7 +10625,7 @@ int virStreamEventRemoveCallback(virStreamPtr stream)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -10834,7 +10639,7 @@ int virStreamEventRemoveCallback(virStreamPtr stream)
         return ret;
     }
 
-    virLibConnError (stream->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(stream->conn);
@@ -10863,7 +10668,7 @@ int virStreamFinish(virStreamPtr stream)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -10877,7 +10682,7 @@ int virStreamFinish(virStreamPtr stream)
         return ret;
     }
 
-    virLibConnError (stream->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(stream->conn);
@@ -10904,7 +10709,7 @@ int virStreamAbort(virStreamPtr stream)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -10918,7 +10723,7 @@ int virStreamAbort(virStreamPtr stream)
         return ret;
     }
 
-    virLibConnError (stream->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(stream->conn);
@@ -10946,7 +10751,7 @@ int virStreamFree(virStreamPtr stream)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STREAM(stream)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -10976,7 +10781,7 @@ int virDomainIsActive(virDomainPtr dom)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(dom)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -10988,7 +10793,8 @@ int virDomainIsActive(virDomainPtr dom)
         return ret;
     }
 
-    virLibConnError(dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(dom->conn);
     return -1;
@@ -11010,7 +10816,7 @@ int virDomainIsPersistent(virDomainPtr dom)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(dom)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -11022,7 +10828,8 @@ int virDomainIsPersistent(virDomainPtr dom)
         return ret;
     }
 
-    virLibConnError(dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(dom->conn);
     return -1;
@@ -11043,7 +10850,7 @@ int virNetworkIsActive(virNetworkPtr net)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(net)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -11055,7 +10862,8 @@ int virNetworkIsActive(virNetworkPtr net)
         return ret;
     }
 
-    virLibConnError(net->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(net->conn);
     return -1;
@@ -11078,7 +10886,7 @@ int virNetworkIsPersistent(virNetworkPtr net)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NETWORK(net)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -11090,7 +10898,8 @@ int virNetworkIsPersistent(virNetworkPtr net)
         return ret;
     }
 
-    virLibConnError(net->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(net->conn);
     return -1;
@@ -11112,7 +10921,7 @@ int virStoragePoolIsActive(virStoragePoolPtr pool)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -11124,7 +10933,8 @@ int virStoragePoolIsActive(virStoragePoolPtr pool)
         return ret;
     }
 
-    virLibConnError(pool->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(pool->conn);
     return -1;
@@ -11147,7 +10957,7 @@ int virStoragePoolIsPersistent(virStoragePoolPtr pool)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -11159,7 +10969,8 @@ int virStoragePoolIsPersistent(virStoragePoolPtr pool)
         return ret;
     }
 
-    virLibConnError(pool->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(pool->conn);
     return -1;
@@ -11183,7 +10994,7 @@ virConnectNumOfNWFilters(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -11196,7 +11007,7 @@ virConnectNumOfNWFilters(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -11222,13 +11033,13 @@ virConnectListNWFilters(virConnectPtr conn, char **const names, int maxnames)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     if ((names == NULL) || (maxnames < 0)) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11240,7 +11051,7 @@ virConnectListNWFilters(virConnectPtr conn, char **const names, int maxnames)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -11266,12 +11077,12 @@ virNWFilterLookupByName(virConnectPtr conn, const char *name)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (name == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto  error;
     }
 
@@ -11283,7 +11094,7 @@ virNWFilterLookupByName(virConnectPtr conn, const char *name)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -11308,12 +11119,12 @@ virNWFilterLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuid == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11325,7 +11136,7 @@ virNWFilterLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -11351,17 +11162,17 @@ virNWFilterLookupByUUIDString(virConnectPtr conn, const char *uuidstr)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (uuidstr == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
     if (virUUIDParse(uuidstr, uuid) < 0) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11389,7 +11200,7 @@ virNWFilterFree(virNWFilterPtr nwfilter)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NWFILTER(nwfilter)) {
-        virLibNWFilterError(NULL, VIR_ERR_INVALID_NWFILTER, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_INVALID_NWFILTER, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -11417,7 +11228,7 @@ virNWFilterGetName(virNWFilterPtr nwfilter)
     virResetLastError();
 
     if (!VIR_IS_NWFILTER(nwfilter)) {
-        virLibNWFilterError(NULL, VIR_ERR_INVALID_NWFILTER, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_INVALID_NWFILTER, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
@@ -11441,12 +11252,12 @@ virNWFilterGetUUID(virNWFilterPtr nwfilter, unsigned char *uuid)
     virResetLastError();
 
     if (!VIR_IS_NWFILTER(nwfilter)) {
-        virLibNWFilterError(NULL, VIR_ERR_INVALID_NWFILTER, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_INVALID_NWFILTER, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     if (uuid == NULL) {
-        virLibNWFilterError(nwfilter, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11478,12 +11289,12 @@ virNWFilterGetUUIDString(virNWFilterPtr nwfilter, char *buf)
     virResetLastError();
 
     if (!VIR_IS_NWFILTER(nwfilter)) {
-        virLibNWFilterError(NULL, VIR_ERR_INVALID_NWFILTER, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_INVALID_NWFILTER, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
     if (buf == NULL) {
-        virLibNWFilterError(nwfilter, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11517,16 +11328,16 @@ virNWFilterDefineXML(virConnectPtr conn, const char *xmlDesc)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (xmlDesc == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibConnError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11538,7 +11349,7 @@ virNWFilterDefineXML(virConnectPtr conn, const char *xmlDesc)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -11565,14 +11376,14 @@ virNWFilterUndefine(virNWFilterPtr nwfilter)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NWFILTER(nwfilter)) {
-        virLibNWFilterError(NULL, VIR_ERR_INVALID_NWFILTER, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_INVALID_NWFILTER, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     conn = nwfilter->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibNWFilterError(nwfilter, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11584,7 +11395,7 @@ virNWFilterUndefine(virNWFilterPtr nwfilter)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(nwfilter->conn);
@@ -11612,12 +11423,12 @@ virNWFilterGetXMLDesc(virNWFilterPtr nwfilter, int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_NWFILTER(nwfilter)) {
-        virLibNWFilterError(NULL, VIR_ERR_INVALID_NWFILTER, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_INVALID_NWFILTER, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (NULL);
     }
     if (flags != 0) {
-        virLibNWFilterError(nwfilter, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibNWFilterError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11631,7 +11442,7 @@ virNWFilterGetXMLDesc(virNWFilterPtr nwfilter, int flags)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(nwfilter->conn);
@@ -11660,7 +11471,7 @@ int
 virNWFilterRef(virNWFilterPtr nwfilter)
 {
     if ((!VIR_IS_CONNECTED_NWFILTER(nwfilter))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -11687,7 +11498,7 @@ int virInterfaceIsActive(virInterfacePtr iface)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -11699,7 +11510,8 @@ int virInterfaceIsActive(virInterfacePtr iface)
         return ret;
     }
 
-    virLibConnError(iface->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(iface->conn);
     return -1;
@@ -11721,7 +11533,7 @@ int virConnectIsEncrypted(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -11733,7 +11545,8 @@ int virConnectIsEncrypted(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(conn);
     return -1;
@@ -11758,7 +11571,7 @@ int virConnectIsSecure(virConnectPtr conn)
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
@@ -11770,7 +11583,8 @@ int virConnectIsSecure(virConnectPtr conn)
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(conn);
     return -1;
@@ -11797,12 +11611,12 @@ virConnectCompareCPU(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return VIR_CPU_COMPARE_ERROR;
     }
     if (xmlDesc == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11815,7 +11629,7 @@ virConnectCompareCPU(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -11854,12 +11668,12 @@ virConnectBaselineCPU(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return NULL;
     }
     if (xmlCPUs == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11872,7 +11686,7 @@ virConnectBaselineCPU(virConnectPtr conn,
         return cpu;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -11899,12 +11713,12 @@ virDomainGetJobInfo(virDomainPtr domain, virDomainJobInfoPtr info)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (info == NULL) {
-        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11920,7 +11734,7 @@ virDomainGetJobInfo(virDomainPtr domain, virDomainJobInfoPtr info)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(domain->conn);
@@ -11948,14 +11762,14 @@ virDomainAbortJob(virDomainPtr domain)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
 
     conn = domain->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -11967,7 +11781,7 @@ virDomainAbortJob(virDomainPtr domain)
         return ret;
     }
 
-    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -11999,14 +11813,14 @@ virDomainMigrateSetMaxDowntime(virDomainPtr domain,
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     conn = domain->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -12016,7 +11830,8 @@ virDomainMigrateSetMaxDowntime(virDomainPtr domain,
         return 0;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(conn);
     return -1;
@@ -12067,18 +11882,18 @@ virConnectDomainEventRegisterAny(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (dom != NULL &&
         !(VIR_IS_CONNECTED_DOMAIN(dom) && dom->conn == conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(conn);
         return (-1);
     }
     if (eventID < 0 || eventID >= VIR_DOMAIN_EVENT_ID_LAST || cb == NULL) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -12090,7 +11905,8 @@ virConnectDomainEventRegisterAny(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(conn);
     return -1;
@@ -12115,12 +11931,12 @@ virConnectDomainEventDeregisterAny(virConnectPtr conn,
     virResetLastError();
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_CONN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return (-1);
     }
     if (callbackID < 0) {
-        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, "%s", __FUNCTION__);
         goto error;
     }
     if ((conn->driver) && (conn->driver->domainEventDeregisterAny)) {
@@ -12131,7 +11947,8 @@ virConnectDomainEventDeregisterAny(virConnectPtr conn,
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
+
 error:
     virDispatchError(conn);
     return -1;
@@ -12161,14 +11978,14 @@ int virDomainManagedSave(virDomainPtr dom, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(dom)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     conn = dom->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(dom, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -12181,7 +11998,7 @@ int virDomainManagedSave(virDomainPtr dom, unsigned int flags)
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -12209,7 +12026,7 @@ int virDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(dom)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
@@ -12225,7 +12042,7 @@ int virDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
@@ -12250,14 +12067,14 @@ int virDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
     virResetLastError();
 
     if (!VIR_IS_CONNECTED_DOMAIN(dom)) {
-        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(VIR_ERR_INVALID_DOMAIN, "%s", __FUNCTION__);
         virDispatchError(NULL);
         return -1;
     }
 
     conn = dom->conn;
     if (conn->flags & VIR_CONNECT_RO) {
-        virLibDomainError(dom, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virLibDomainError(VIR_ERR_OPERATION_DENIED, "%s", __FUNCTION__);
         goto error;
     }
 
@@ -12270,7 +12087,7 @@ int virDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
         return ret;
     }
 
-    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virLibConnError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__);
 
 error:
     virDispatchError(conn);
-- 
1.6.3.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]