[PATCH 4/6] qemuProcessReportLogError: Remove unnecessary math for max error message

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

 



Now that error message formatting doesn't use fixed size buffers we can
drop the math for calculating the maximum chunk of log to report in the
error message and use a round number. This also makes it obvious that
the chosen number is arbitrary.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 398f63282e..55649286ae 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2140,14 +2140,9 @@ qemuProcessReportLogError(qemuDomainLogContextPtr logCtxt,
                           const char *msgprefix)
 {
     g_autofree char *logmsg = NULL;
-    size_t max;

-    max = VIR_ERROR_MAX_LENGTH - 1;
-    max -= strlen(msgprefix);
-    /* The length of the formatting string minus two '%s' */
-    max -= strlen(_("%s: %s")) - 4;
-
-    if (qemuProcessReadLog(logCtxt, &logmsg, max) < 0)
+    /* assume that 1024 chars of qemu log is the right balance */
+    if (qemuProcessReadLog(logCtxt, &logmsg, 1024) < 0)
         return -1;

     virResetLastError();
-- 
2.29.2




[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]

  Powered by Linux