From 326231611bda6808b579ab7286e471c36f62e98c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chirag=20Dav=C3=A9?= Date: Wed, 4 May 2016 21:40:28 -0700 Subject: [PATCH] fReopenDebugLog and fRequestShutdown should be type sig_atomic_t This allows access as an atomic variable in the presence of async interrupts. See issue #7433 for more details fixes: #7433 --- src/init.cpp | 2 +- src/util.cpp | 2 +- src/util.h | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index b06f448a0..a9b3f88a3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -125,7 +125,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat"; // shutdown thing. // -volatile bool fRequestShutdown = false; +volatile sig_atomic_t fRequestShutdown = false; void StartShutdown() { diff --git a/src/util.cpp b/src/util.cpp index 00b75fbdb..579be338e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -113,7 +113,7 @@ string strMiscWarning; bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS; bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS; bool fLogIPs = DEFAULT_LOGIPS; -volatile bool fReopenDebugLog = false; +volatile sig_atomic_t fReopenDebugLog = false; CTranslationInterface translationInterface; /** Init OpenSSL library multithreading support */ diff --git a/src/util.h b/src/util.h index ac099f118..33db0f9e4 100644 --- a/src/util.h +++ b/src/util.h @@ -28,6 +28,10 @@ #include #include +#ifndef WIN32 +#include +#endif + static const bool DEFAULT_LOGTIMEMICROS = false; static const bool DEFAULT_LOGIPS = false; static const bool DEFAULT_LOGTIMESTAMPS = true; @@ -50,7 +54,7 @@ extern std::string strMiscWarning; extern bool fLogTimestamps; extern bool fLogTimeMicros; extern bool fLogIPs; -extern volatile bool fReopenDebugLog; +extern volatile sig_atomic_t fReopenDebugLog; extern CTranslationInterface translationInterface; extern const char * const BITCOIN_CONF_FILENAME;