mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 22:31:48 +01:00
lightningd: fix fatal() log message in log.
The one to stderr is fine, the log one gets corrupted, like so: ``` 2022-07-24T07:20:08.6250702Z lightningd-2 2022-07-24T06:49:19.494Z **BROKEN** lightningd: Plugin '????UH??SH??8H?}?H?u?H?U?H?M?H?M?H?E?H?????' returned an invalid response to the db_write hook: (F???U ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
d0c321b43a
commit
0fd8a6492e
1 changed files with 7 additions and 1 deletions
|
@ -840,14 +840,20 @@ void log_backtrace_exit(void)
|
|||
|
||||
void fatal_vfmt(const char *fmt, va_list ap)
|
||||
{
|
||||
va_list ap2;
|
||||
|
||||
/* You are not allowed to re-use va_lists, so make a copy. */
|
||||
va_copy(ap2, ap);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
if (!crashlog)
|
||||
exit(1);
|
||||
|
||||
logv(crashlog, LOG_BROKEN, NULL, true, fmt, ap);
|
||||
logv(crashlog, LOG_BROKEN, NULL, true, fmt, ap2);
|
||||
abort();
|
||||
/* va_copy() must be matched with va_end(), even if unreachable. */
|
||||
va_end(ap2);
|
||||
}
|
||||
|
||||
void fatal(const char *fmt, ...)
|
||||
|
|
Loading…
Add table
Reference in a new issue