From: Peter Krempa Date: Tue, 23 Feb 2021 14:27:07 +0000 (+0100) Subject: qemuProcessReportLogError: Remove unnecessary math for max error message X-Git-Tag: v7.2.0-rc1~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8ff56c7ad33b144ac94aae6b25ed9e6a5ea1852;p=thirdparty%2Flibvirt.git qemuProcessReportLogError: Remove unnecessary math for max error message 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 Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d3208e5203..20f920513d 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();