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

[libvirt] [PATCH v2 2/9] util: error: Fix error message strings to play well with additional info



Additional information for an error message is either in form of a
string or empty. Fix two offenders. One used %d as the format modifier
and the second one  always expected a string.

Thankfully, neither of the offenders are currently in effect.

Signed-off-by: Peter Krempa <pkrempa redhat com>
Reviewed-by: Erik Skultety <eskultet redhat com>
---
 src/util/virerror.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/util/virerror.c b/src/util/virerror.c
index eca6ddf7d1..5d515bde57 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -977,7 +977,10 @@ virErrorMsg(virErrorNumber error, const char *info)
                 errmsg = _("POST operation failed");
             break;
         case VIR_ERR_HTTP_ERROR:
-            errmsg = _("got unknown HTTP error code %d");
+            if (info != NULL)
+                errmsg = _("got unknown HTTP error code %s");
+            else
+                errmsg = _("got unknown HTTP error code");
             break;
         case VIR_ERR_UNKNOWN_HOST:
             if (info != NULL)
@@ -1004,7 +1007,10 @@ virErrorMsg(virErrorNumber error, const char *info)
                 errmsg = _("could not connect to Xen Store %s");
             break;
         case VIR_ERR_XEN_CALL:
-            errmsg = _("failed Xen syscall %s");
+            if (info == NULL)
+                errmsg = _("failed Xen syscall");
+            else
+                errmsg = _("failed Xen syscall %s");
             break;
         case VIR_ERR_OS_TYPE:
             if (info == NULL)
-- 
2.19.2


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