]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuProcessReportLogError: Remove unnecessary math for max error message
authorPeter Krempa <pkrempa@redhat.com>
Tue, 23 Feb 2021 14:27:07 +0000 (15:27 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 5 Mar 2021 14:01:29 +0000 (15:01 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_process.c

index d3208e520328a4575a534e93d9e35c89ea6cfd26..20f920513d9035411529e4a9d845cb57cbc2e10f 100644 (file)
@@ -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();