diff options
| author | Andreas Haas | 2017-10-06 13:16:21 +0200 |
|---|---|---|
| committer | GitHub | 2017-10-06 13:16:21 +0200 |
| commit | fd1d886cf899a2052125411b1fec6f41902b86f8 (patch) | |
| tree | 5d82278c421854224f70593d125d7a57ee38c27f /core | |
| parent | 701c77ba29e6df57b37d5715dc9f7029674cd9ae (diff) | |
| parent | 01ebcfe8418a0d4e54da54191e9302bfeaba4a19 (diff) | |
| download | godot-fd1d886cf899a2052125411b1fec6f41902b86f8.tar.gz godot-fd1d886cf899a2052125411b1fec6f41902b86f8.tar.zst godot-fd1d886cf899a2052125411b1fec6f41902b86f8.zip | |
Merge pull request #11853 from endragor/long-string-logging
Fix logging of long strings via RotatedFileLogger
Diffstat (limited to 'core')
| -rw-r--r-- | core/io/logger.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/io/logger.cpp b/core/io/logger.cpp index 7ea5f06d7..b94007d31 100644 --- a/core/io/logger.cpp +++ b/core/io/logger.cpp @@ -177,11 +177,14 @@ void RotatedFileLogger::logv(const char *p_format, va_list p_list, bool p_err) { const int static_buf_size = 512; char static_buf[static_buf_size]; char *buf = static_buf; + va_list list_copy; + va_copy(list_copy, p_list); int len = vsnprintf(buf, static_buf_size, p_format, p_list); if (len >= static_buf_size) { buf = (char *)Memory::alloc_static(len + 1); - vsnprintf(buf, len + 1, p_format, p_list); + vsnprintf(buf, len + 1, p_format, list_copy); } + va_end(list_copy); file->store_buffer((uint8_t *)buf, len); if (len >= static_buf_size) { Memory::free_static(buf); |
