libplugin: tell compiler that plugin_err is like printf.

And fix the fallout!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-11-06 21:18:36 +10:30
parent 6303a96ee2
commit c85dd95c12
3 changed files with 11 additions and 10 deletions

View File

@ -1006,17 +1006,18 @@ static void parse_getnetworkinfo_result(struct plugin *p, const char *buf)
if (!result)
plugin_err(p, "Invalid response to '%s': '%s'. Can not "
"continue without proceeding to sanity checks.",
gather_args(bitcoind, "getnetworkinfo", NULL), buf);
args_string(tmpctx, gather_args(bitcoind, "getnetworkinfo", NULL)),
buf);
/* Check that we have a fully-featured `estimatesmartfee`. */
err = json_scan(tmpctx, buf, result, "{version:%,localrelay:%}",
JSON_SCAN(json_to_u32, &bitcoind->version),
JSON_SCAN(json_to_bool, &tx_relay));
if (err)
plugin_err(p, "%s. Got '%s'. Can not"
plugin_err(p, "%s. Got '%.*s'. Can not"
" continue without proceeding to sanity checks.",
err,
gather_args(bitcoind, "getnetworkinfo", NULL), buf);
json_tok_full_len(result), json_tok_full(buf, result));
if (bitcoind->version < min_version)
plugin_err(p, "Unsupported bitcoind version %"PRIu32", at least"

View File

@ -891,7 +891,7 @@ static struct command_result *listpeerchannels_multi_done(struct command *cmd,
db_commit_transaction(db);
if (err)
plugin_err(cmd->plugin, err);
plugin_err(cmd->plugin, "%s", err);
/* FIXME: multiple currencies */
if (tal_count(balances) > 0)
@ -907,7 +907,7 @@ static struct command_result *listpeerchannels_multi_done(struct command *cmd,
bal->debit,
&credit_diff, &debit_diff);
if (err)
plugin_err(cmd->plugin, err);
plugin_err(cmd->plugin, "%s", err);
log_journal_entry(info->acct,
info->currency,
@ -1327,7 +1327,7 @@ listpeerchannels_done(struct command *cmd, const char *buf,
db_commit_transaction(db);
if (err)
plugin_err(cmd->plugin, err);
plugin_err(cmd->plugin, "%s", err);
/* FIXME: multiple currencies per account? */
if (tal_count(balances) > 0)
@ -1346,7 +1346,7 @@ listpeerchannels_done(struct command *cmd, const char *buf,
bal->debit,
&credit_diff, &debit_diff);
if (err)
plugin_err(cmd->plugin, err);
plugin_err(cmd->plugin, "%s", err);
log_journal_entry(info->acct,
info->ev->currency,
@ -1360,7 +1360,7 @@ listpeerchannels_done(struct command *cmd, const char *buf,
/* Maybe mark acct as onchain resolved */
err = do_account_close_checks(cmd, info->ev, info->acct);
if (err)
plugin_err(cmd->plugin, err);
plugin_err(cmd->plugin, "%s", err);
if (info->ev->payment_id &&
streq(info->ev->tag, mvt_tag_str(INVOICE))) {
@ -1576,7 +1576,7 @@ parse_and_log_chain_move(struct command *cmd,
/* Maybe mark acct as onchain resolved */
err = do_account_close_checks(cmd, e, acct);
if (err)
plugin_err(cmd->plugin, err);
plugin_err(cmd->plugin, "%s", err);
/* Check for invoice desc data, necessary */
if (e->payment_id) {

View File

@ -322,7 +322,7 @@ bool command_deprecated_in_nocmd_ok(struct plugin *plugin,
const char *depr_end);
/* Call this on fatal error. */
void NORETURN plugin_err(struct plugin *p, const char *fmt, ...);
void NORETURN PRINTF_FMT(2,3) plugin_err(struct plugin *p, const char *fmt, ...);
/* Call this on fatal error. */
void NORETURN plugin_errv(struct plugin *p, const char *fmt, va_list ap);