From 2c0b52fb77491f7b14259430f337f4e62bce7805 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 13 Jul 2017 15:36:50 +0200 Subject: [PATCH] bitcoin: Make chainparams const `cli` and `cli_args` were not `const` before since they are added to a non-`const` array. Using `cast_const` we can keep them `const` without unsafe cast. Reported-by: Rusty Russell Signed-off-by: Christian Decker --- bitcoin/chainparams.h | 4 ++-- daemon/bitcoind.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bitcoin/chainparams.h b/bitcoin/chainparams.h index 5709cc1e2..a0fd5b813 100644 --- a/bitcoin/chainparams.h +++ b/bitcoin/chainparams.h @@ -11,8 +11,8 @@ struct chainparams { const char *network_name; const struct sha256_double genesis_blockhash; const int rpc_port; - char *cli; - char *cli_args; + const char *cli; + const char *cli_args; const u64 dust_limit; /* Whether this is a test network or not */ diff --git a/daemon/bitcoind.c b/daemon/bitcoind.c index bc010d80e..3f1a2752b 100644 --- a/daemon/bitcoind.c +++ b/daemon/bitcoind.c @@ -30,8 +30,8 @@ static char **gather_args(struct bitcoind *bitcoind, size_t n = 0; char **args = tal_arr(ctx, char *, 3); - args[n++] = bitcoind->chainparams->cli; - args[n++] = bitcoind->chainparams->cli_args; + args[n++] = cast_const(char *, bitcoind->chainparams->cli); + args[n++] = cast_const(char *, bitcoind->chainparams->cli_args); if (bitcoind->datadir) { args[n++] = tal_fmt(args, "-datadir=%s", bitcoind->datadir);