util/log: Fix log messages over 1024 characters.
authorEmma Anholt <emma@anholt.net>
Thu, 20 Apr 2023 23:12:57 +0000 (16:12 -0700)
committerMarge Bot <emma+marge@anholt.net>
Mon, 24 Apr 2023 21:56:05 +0000 (21:56 +0000)
commit7f99cbf25e2d760cba70e210523a988df0f6b41a
tree7c5b34e1b3b41830b81808778fbf4ba3c242cd9f
parent4cfb4f7d126370784cc74a4ac02e3a511e5f5d36
util/log: Fix log messages over 1024 characters.

The first attempt at the sprintf would have consumed part of va, so if
we're going to recurse on overflow to try again in a new allocation then
we have to do our work on a copy.

This was a common failure mode for MESA_GLSL=source, where it would just print:

  Mesa: info: GLSL source for fragment shader 1:
  Mesa: info: (null)

Fixes: 7a18a1712a0a ("util/log: improve logger_file newline handling")
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22618>
src/util/log.c