From b081c5c33b53e7bc80780ae507d77b9de10f60ef Mon Sep 17 00:00:00 2001
From: tumbili <bapstr@ethz.ch>
Date: Fri, 23 Oct 2015 14:00:24 +0200
Subject: [PATCH] added signal handler for floating point exceptions

---
 src/platforms/posix/main.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/platforms/posix/main.cpp b/src/platforms/posix/main.cpp
index 26465c266e..1b22627721 100644
--- a/src/platforms/posix/main.cpp
+++ b/src/platforms/posix/main.cpp
@@ -66,6 +66,13 @@ extern "C" {
 		cout.flush();
 		_exit(0);
 	}
+	void _SigFpeHandler(int sig_num);
+	void _SigFpeHandler(int sig_num)
+	{
+		cout.flush();
+		cout << endl << "floating point exception" << endl;
+		cout.flush();
+	}
 }
 
 static void print_prompt()
@@ -137,6 +144,7 @@ int main(int argc, char **argv)
 {
 	bool daemon_mode = false;
 	signal(SIGINT, _SigIntHandler);
+	signal(SIGFPE, _SigFpeHandler);
 
 	int index = 1;
 	bool error_detected = false;
-- 
GitLab