diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-08-23 12:57:58 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-08-23 12:58:01 +0200 |
commit | f6f7a12462b381945b1cb9bcb94b129d8fb7e289 (patch) | |
tree | f295ea5f19068f35df308981b92bc6714f33c8ae /src/bitcoin-cli-res.rc | |
parent | 489beb39842fd49393823953940510c28b169c95 (diff) | |
parent | 127b4608e9dbb8217c74c9332e82fcec8c326fa8 (diff) |
Merge bitcoin/bitcoin#22622: util: Check if specified config file cannot be opened
127b4608e9dbb8217c74c9332e82fcec8c326fa8 test: Check if specified config file cannot be opened (nthumann)
6bb54708e6457f21596793a7149dc6dfea1dc871 util: Check if specified config file cannot be opened (nthumann)
Pull request description:
Fixes https://github.com/bitcoin/bitcoin/issues/22612.
When running e.g. `./src/bitcoind -datadir=/tmp/bitcoin -regtest -conf=/tmp/bitcoin/regtest/bitcoin.conf` and the specified config cannot be opened (doesn't exist, permission denied, ...), the initialization silently uses the default config.
As voidburn already noted:
> I can't think of a situation in which a config file is specified explicitly (in the startup options, as per service unit linked above), but inaccessible, where the fail condition should be to keep booting using defaults instead.
With this patch applied, the initialization will fail immediately, if the specified config file cannot be opened. If no config file is explicitly specified, the behavior is unchanged. This not only affects `bitcoind`, but also `bitcoin-cli` and `bitcoin-qt`.
In the example below the datadir is accessible, but the config file is not due to insufficient permissions:
```
$ ./src/bitcoind -datadir=/tmp/bitcoin -regtest --debug=1 -conf=/tmp/bitcoin/regtest/bitcoin.conf
Error: Error reading configuration file: specified config file "/tmp/bitcoin/regtest/bitcoin.conf" could not be opened.
```
ACKs for top commit:
0xB10C:
ACK 127b4608e9dbb8217c74c9332e82fcec8c326fa8
Zero-1729:
tACK 127b4608e9dbb8217c74c9332e82fcec8c326fa8
theStack:
Tested ACK 127b4608e9dbb8217c74c9332e82fcec8c326fa8
Tree-SHA512: 4fe487921485426f1d1da8d256c388af517b984b639d776aec7b159b3e23b669824093d3bdd31139d9415ed5f5de405b3e6a51b110c8ab471f12b9c99ac67cc1
Diffstat (limited to 'src/bitcoin-cli-res.rc')
0 files changed, 0 insertions, 0 deletions