summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-05-13 19:42:57 +0000
committerChristian Pointner <equinox@anytun.org>2008-05-13 19:42:57 +0000
commit5ed2af680d89d8643530f5e9f26ccb832e6bad3e (patch)
treef857d9d74e00be8d56314a5ceeb05ad47c78cf6d
parentfixed build on linux (diff)
added extra catch for std::runtime_error
-rw-r--r--src/Makefile2
-rw-r--r--src/anytun.cpp15
2 files changed, 17 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
index 8046245..eca9774 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -11,6 +11,8 @@ LD = g++
LDFLAGS = -g -Wall -O2 -lpthread -lgcrypt -lgpg-error -lboost_serialization
ifeq ($(TARGET),Linux)
+# CFLAGS += -D_XOPEN_SOURCE=600
+# CCFLAGS += -D_XOPEN_SOURCE=600
LDFLAGS += -ldl
endif
ifeq ($(TARGET),OpenBSD)
diff --git a/src/anytun.cpp b/src/anytun.cpp
index 3d985d4..ed6d845 100644
--- a/src/anytun.cpp
+++ b/src/anytun.cpp
@@ -191,6 +191,10 @@ void* sender(void* p)
}
}
}
+ catch(std::runtime_error e)
+ {
+ cLog.msg(Log::PRIO_ERR) << "sender thread died due to an uncaught runtime_error: " << e.what();
+ }
catch(std::exception e)
{
cLog.msg(Log::PRIO_ERR) << "sender thread died due to an uncaught exception: " << e.what();
@@ -323,6 +327,10 @@ void* receiver(void* p)
param->dev.write(plain_packet.getPayload(), plain_packet.getLength());
}
}
+ catch(std::runtime_error e)
+ {
+ cLog.msg(Log::PRIO_ERR) << "sender thread died due to an uncaught runtime_error: " << e.what();
+ }
catch(std::exception e)
{
cLog.msg(Log::PRIO_ERR) << "receiver thread died due to an uncaught exception: " << e.what();
@@ -567,6 +575,13 @@ int main(int argc, char* argv[])
return ret;
}
+ catch(std::runtime_error e)
+ {
+ if(daemonized)
+ cLog.msg(Log::PRIO_ERR) << "uncaught runtime error, exiting: " << e.what();
+ else
+ std::cout << "uncaught runtime error, exiting: " << e.what() << std::endl;
+ }
catch(std::exception e)
{
if(daemonized)