aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-10-04 14:53:26 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-10-04 14:54:09 +0200
commita1f7f1870931fe978069482ec0f7dc7d59456966 (patch)
treeae2bededf8fdacfa73b1cd64d87fc30d54e6c022 /src/init.cpp
parente12522dfdaaba989c839b429cf3b3b34fd93d171 (diff)
parentcffe85f975413441b8fbc5bda82fd2c9d75476f5 (diff)
downloadbitcoin-a1f7f1870931fe978069482ec0f7dc7d59456966.tar.xz
Merge #10939: [init] Check non-emptiness of -blocknotify command prior to executing
cffe85f Skip sys::system(...) call in case of empty command (practicalswift) 6fb8f5f Check that -blocknotify command is non-empty before executing (practicalswift) Pull request description: Check that `-blocknotify` command is non-empty before executing. To make the `BlockNotifyCallback(...)` (`-blocknotify`) behaviour consistent with that of: * `AlertNotify(...)` (`-alertnotify`) * `AddToWallet(...)` (`-walletnotify`) Tree-SHA512: 18272166793a5a8b9cc2a727bfbcea53d38c329a55bc975c02db601329d608a61c20e026ce4b616193ecd3810dca4d3e2cb3bf773898a51872008a8dba96763e
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 55670c7dc6..b46b53ac13 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -537,9 +537,10 @@ static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex
return;
std::string strCmd = gArgs.GetArg("-blocknotify", "");
-
- boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex());
- boost::thread t(runCommand, strCmd); // thread runs free
+ if (!strCmd.empty()) {
+ boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex());
+ boost::thread t(runCommand, strCmd); // thread runs free
+ }
}
static bool fHaveGenesis = false;