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

[Libvir] [PATCH] Use virErrorMsg in qemudReportError



Currently the qemu driver doesn't use virErrorMsg when raising error
messages. This causes some errors to appear as "libvir: QEMU error: "
if a custom string wasn't raised, which isn't all that useful. The
patch below fixes this.

Thanks,
Cole

diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index e39c7bc..6aed88b 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -58,6 +58,7 @@ void qemudReportError(virConnectPtr conn,
                       int code, const char *fmt, ...) {
     va_list args;
     char errorMessage[QEMUD_MAX_ERROR_LEN];
+    const char *virerr;
 
     if (fmt) {
         va_start(args, fmt);
@@ -66,8 +67,10 @@ void qemudReportError(virConnectPtr conn,
     } else {
         errorMessage[0] = '\0';
     }
+
+    virerr = __virErrorMsg(code, (errorMessage[0] ? errorMessage[0] : NULL));
     __virRaiseError(conn, dom, net, VIR_FROM_QEMU, code, VIR_ERR_ERROR,
-                    NULL, NULL, NULL, -1, -1, "%s", errorMessage);
+                    virerr, errorMessage, NULL, -1, -1, virerr, errorMessage);
 }
 
 int qemudLoadDriverConfig(struct qemud_driver *driver,


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