aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoin.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2012-07-06 13:45:38 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2012-07-17 09:37:12 +0200
commit41c938eede3e9ea29ef86f3c25bab8fa6a51a509 (patch)
treea32400a0101478c5f761409f8370007ae0e69660 /src/qt/bitcoin.cpp
parentce652affe0ffec114bceb2e2c20ae1d015faca53 (diff)
downloadbitcoin-41c938eede3e9ea29ef86f3c25bab8fa6a51a509.tar.xz
IPC-server hardening and update
- add IMPLEMENT_RANDOMIZE_STACK for ipcThread() - log / print boost interprocess exceptions - use MAX_URI_LENGTH in guiconstants.h (also used in qrcodedialog.cpp) - remove unneeded includes and ipcShutdown() from qtipcserver.cpp - fix a small mem-leak by deleting mq before re-using it - make ipcThread() and ipcThread2() static functions - add some more comments
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r--src/qt/bitcoin.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 55b5f74c3b..f9f5115cd0 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -126,13 +126,21 @@ int main(int argc, char *argv[])
const char *strURI = argv[i];
try {
boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
- if(mq.try_send(strURI, strlen(strURI), 0))
+ if (mq.try_send(strURI, strlen(strURI), 0))
+ // if URI could be sent to the message queue exit here
exit(0);
else
+ // if URI could not be sent to the message queue do a normal Bitcoin-Qt startup
break;
}
catch (boost::interprocess::interprocess_exception &ex) {
- break;
+ // don't log the "file not found" exception, because that's normal for
+ // the first start of the first instance
+ if (ex.get_error_code() != boost::interprocess::not_found_error)
+ {
+ printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
+ break;
+ }
}
}
}
@@ -278,6 +286,8 @@ int main(int argc, char *argv[])
mq.try_send(strURI, strlen(strURI), 0);
}
catch (boost::interprocess::interprocess_exception &ex) {
+ printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
+ break;
}
}
}