aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bitcoin-qt.pro2
-rw-r--r--src/bitcoinrpc.h1
-rw-r--r--src/db.cpp7
-rw-r--r--src/init.cpp12
-rw-r--r--src/makefile.linux-mingw2
-rw-r--r--src/makefile.mingw2
-rw-r--r--src/makefile.osx2
-rw-r--r--src/makefile.unix2
-rw-r--r--src/qt/bitcoinaddressvalidator.cpp28
-rw-r--r--src/qt/forms/askpassphrasedialog.ui14
-rw-r--r--src/util.cpp12
-rw-r--r--src/util.h1
12 files changed, 61 insertions, 24 deletions
diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro
index ae4ef79cb8..a47d661678 100644
--- a/bitcoin-qt.pro
+++ b/bitcoin-qt.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
TARGET =
VERSION = 0.6.99
INCLUDEPATH += src src/json src/qt
-DEFINES += QT_GUI BOOST_THREAD_USE_LIB USE_IPV6
+DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE USE_IPV6
CONFIG += no_include_pwd
# for boost 1.37, add -mt to the boost libraries
diff --git a/src/bitcoinrpc.h b/src/bitcoinrpc.h
index 0df6495818..8b2d905179 100644
--- a/src/bitcoinrpc.h
+++ b/src/bitcoinrpc.h
@@ -9,7 +9,6 @@
#include <string>
#include <map>
-#define BOOST_SPIRIT_THREADSAFE
#include "json/json_spirit_reader_template.h"
#include "json/json_spirit_writer_template.h"
#include "json/json_spirit_utils.h"
diff --git a/src/db.cpp b/src/db.cpp
index 90442f77f2..a0b9dc20f7 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -76,6 +76,10 @@ CDB::CDB(const char *pszFile, const char* pszMode) : pdb(NULL)
if (fCreate)
nFlags |= DB_CREATE;
+ unsigned int nEnvFlags = 0;
+ if (GetBoolArg("-privdb", true))
+ nEnvFlags |= DB_PRIVATE;
+
{
LOCK(cs_db);
if (!fDbEnvInit)
@@ -106,7 +110,8 @@ CDB::CDB(const char *pszFile, const char* pszMode) : pdb(NULL)
DB_INIT_MPOOL |
DB_INIT_TXN |
DB_THREAD |
- DB_RECOVER,
+ DB_RECOVER |
+ nEnvFlags,
S_IRUSR | S_IWUSR);
if (ret > 0)
throw runtime_error(strprintf("CDB() : error %d opening database environment", ret));
diff --git a/src/init.cpp b/src/init.cpp
index 4e193ffe3c..325f8e0c50 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -82,6 +82,10 @@ void HandleSIGTERM(int)
fRequestShutdown = true;
}
+void HandleSIGHUP(int)
+{
+ fReopenDebugLog = true;
+}
@@ -291,7 +295,13 @@ bool AppInit2()
sa.sa_flags = 0;
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
- sigaction(SIGHUP, &sa, NULL);
+
+ // Reopen debug.log on SIGHUP
+ struct sigaction sa_hup;
+ sa_hup.sa_handler = HandleSIGHUP;
+ sigemptyset(&sa_hup.sa_mask);
+ sa_hup.sa_flags = 0;
+ sigaction(SIGHUP, &sa_hup, NULL);
#endif
fTestNet = GetBoolArg("-testnet");
diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw
index 61b38a663e..51f49bb3cf 100644
--- a/src/makefile.linux-mingw
+++ b/src/makefile.linux-mingw
@@ -27,7 +27,7 @@ LIBS= \
-l ssl \
-l crypto
-DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DUSE_IPV6
+DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6
DEBUGFLAGS=-g
CFLAGS=-O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
diff --git a/src/makefile.mingw b/src/makefile.mingw
index 47bf8d5304..577c77b7d4 100644
--- a/src/makefile.mingw
+++ b/src/makefile.mingw
@@ -23,7 +23,7 @@ LIBS= \
-l ssl \
-l crypto
-DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DUSE_IPV6
+DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6
DEBUGFLAGS=-g
CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
diff --git a/src/makefile.osx b/src/makefile.osx
index 227756f274..9728733122 100644
--- a/src/makefile.osx
+++ b/src/makefile.osx
@@ -53,7 +53,7 @@ LIBS += \
TESTDEFS += -DBOOST_TEST_DYN_LINK
endif
-DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DUSE_IPV6
+DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6
ifdef RELEASE
# Compile for maximum compatibility and smallest size.
diff --git a/src/makefile.unix b/src/makefile.unix
index 04e17866e5..9052891b4f 100644
--- a/src/makefile.unix
+++ b/src/makefile.unix
@@ -4,7 +4,7 @@
USE_UPNP:=0
-DEFS=-DUSE_IPV6
+DEFS=-DUSE_IPV6 -DBOOST_SPIRIT_THREADSAFE
DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
diff --git a/src/qt/bitcoinaddressvalidator.cpp b/src/qt/bitcoinaddressvalidator.cpp
index 373877808f..d2b93e70f5 100644
--- a/src/qt/bitcoinaddressvalidator.cpp
+++ b/src/qt/bitcoinaddressvalidator.cpp
@@ -21,21 +21,31 @@ BitcoinAddressValidator::BitcoinAddressValidator(QObject *parent) :
QValidator::State BitcoinAddressValidator::validate(QString &input, int &pos) const
{
// Correction
- for(int idx=0; idx<input.size(); ++idx)
+ for(int idx=0; idx<input.size();)
{
- switch(input.at(idx).unicode())
+ bool removeChar = false;
+ QChar ch = input.at(idx);
+ // Corrections made are very conservative on purpose, to avoid
+ // users unexpectedly getting away with typos that would normally
+ // be detected, and thus sending to the wrong address.
+ switch(ch.unicode())
{
- case 'l':
- case 'I':
- input[idx] = QChar('1');
- break;
- case '0':
- case 'O':
- input[idx] = QChar('o');
+ // Qt categorizes these as "Other_Format" not "Separator_Space"
+ case 0x200B: // ZERO WIDTH SPACE
+ case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE
+ removeChar = true;
break;
default:
break;
}
+ // Remove whitespace
+ if(ch.isSpace())
+ removeChar = true;
+ // To next character
+ if(removeChar)
+ input.remove(idx, 1);
+ else
+ ++idx;
}
// Validation
diff --git a/src/qt/forms/askpassphrasedialog.ui b/src/qt/forms/askpassphrasedialog.ui
index e4d86f7cf9..25169042a1 100644
--- a/src/qt/forms/askpassphrasedialog.ui
+++ b/src/qt/forms/askpassphrasedialog.ui
@@ -41,49 +41,49 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
- <item row="1" column="0">
+ <item row="0" column="0">
<widget class="QLabel" name="passLabel1">
<property name="text">
<string>Enter passphrase</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="0" column="1">
<widget class="QLineEdit" name="passEdit1">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
- <item row="2" column="0">
+ <item row="1" column="0">
<widget class="QLabel" name="passLabel2">
<property name="text">
<string>New passphrase</string>
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="1" column="1">
<widget class="QLineEdit" name="passEdit2">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
- <item row="3" column="0">
+ <item row="2" column="0">
<widget class="QLabel" name="passLabel3">
<property name="text">
<string>Repeat new passphrase</string>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="2" column="1">
<widget class="QLineEdit" name="passEdit3">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="3" column="1">
<widget class="QLabel" name="capsLabel">
<property name="font">
<font>
diff --git a/src/util.cpp b/src/util.cpp
index a82625c84d..9e7a8c0348 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -25,6 +25,7 @@ namespace boost {
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/foreach.hpp>
+#include <boost/thread.hpp>
#include <openssl/crypto.h>
#include <openssl/rand.h>
#include <stdarg.h>
@@ -69,6 +70,7 @@ bool fTestNet = false;
bool fNoListen = false;
bool fLogTimestamps = false;
CMedianFilter<int64> vTimeOffsets(200,0);
+bool fReopenDebugLog = false;
// Init openssl library multithreading support
static CCriticalSection** ppmutexOpenSSL;
@@ -207,6 +209,16 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
if (fileout)
{
static bool fStartedNewLine = true;
+ static boost::mutex mutexDebugLog;
+ boost::mutex::scoped_lock scoped_lock(mutexDebugLog);
+
+ // reopen the log file, if requested
+ if (fReopenDebugLog) {
+ fReopenDebugLog = false;
+ boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
+ if (freopen(pathDebug.string().c_str(),"a",fileout) != NULL)
+ setbuf(fileout, NULL); // unbuffered
+ }
// Debug print useful for profiling
if (fLogTimestamps && fStartedNewLine)
diff --git a/src/util.h b/src/util.h
index fde695d123..47065d8426 100644
--- a/src/util.h
+++ b/src/util.h
@@ -116,6 +116,7 @@ extern std::string strMiscWarning;
extern bool fTestNet;
extern bool fNoListen;
extern bool fLogTimestamps;
+extern bool fReopenDebugLog;
void RandAddSeed();
void RandAddSeedPerfmon();