[[PATCH v2] 1/4] util: remove 1k limit for error messages

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

 



This limit is the issue for example when we want to return in the
error message the log of the abnormally exited qemu process of
the destination side in the process of migration.

virVasprintf is already used in the process of logging in
the callers down the stack.
---
 src/util/virerror.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/util/virerror.c b/src/util/virerror.c
index 2958308..ca74c14 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -1427,22 +1427,21 @@ void virReportErrorHelper(int domcode,
 {
     int save_errno = errno;
     va_list args;
-    char errorMessage[1024];
+    char *errorMessage = NULL;
     const char *virerr;
 
     if (fmt) {
         va_start(args, fmt);
-        vsnprintf(errorMessage, sizeof(errorMessage)-1, fmt, args);
+        ignore_value(virVasprintfQuiet(&errorMessage, fmt, args));
         va_end(args);
-    } else {
-        errorMessage[0] = '\0';
     }
 
-    virerr = virErrorMsg(errorcode, (errorMessage[0] ? errorMessage : NULL));
+    virerr = virErrorMsg(errorcode, errorMessage);
     virRaiseErrorFull(filename, funcname, linenr,
                       domcode, errorcode, VIR_ERR_ERROR,
                       virerr, errorMessage, NULL,
                       -1, -1, virerr, errorMessage);
+    VIR_FREE(errorMessage);
     errno = save_errno;
 }
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]