patch db-fatal-plugin_err.patch

This commit is contained in:
Rusty Russell
2022-07-19 17:04:31 +09:30
parent 351dc17e46
commit 721ceb7519
3 changed files with 26 additions and 12 deletions

View File

@@ -1288,18 +1288,26 @@ void NORETURN plugin_exit(struct plugin *p, int exitcode)
exit(exitcode);
}
void NORETURN plugin_errv(struct plugin *p, const char *fmt, va_list ap)
{
va_list ap2;
/* In case it gets consumed, make a copy. */
va_copy(ap2, ap);
plugin_logv(p, LOG_BROKEN, fmt, ap);
vfprintf(stderr, fmt, ap2);
plugin_exit(p, 1);
va_end(ap2);
}
void NORETURN plugin_err(struct plugin *p, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
plugin_logv(p, LOG_BROKEN, fmt, ap);
plugin_errv(p, fmt, ap);
va_end(ap);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
plugin_exit(p, 1);
}
void plugin_log(struct plugin *p, enum log_level l, const char *fmt, ...)