diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/anytun.cpp | 15 |
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) |