From 6e2b70cbcde19a4210270373eada11326d84b200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Wed, 29 May 2019 07:43:06 +0200 Subject: [PATCH] posix: restore original SEGV signal handler upon first entry of our handler The current SEGV handling on posix is not useful: as soon as our handler is left, it's triggered again, infinitely. This patch changes to restore the original handler, so the OS can create a core dump, etc. --- platforms/posix/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/posix/src/main.cpp b/platforms/posix/src/main.cpp index 25da2c5c62..ed1374dded 100644 --- a/platforms/posix/src/main.cpp +++ b/platforms/posix/src/main.cpp @@ -405,7 +405,7 @@ void register_sig_handler() // SIGSEGV struct sigaction sig_segv {}; sig_segv.sa_handler = sig_segv_handler; - sig_segv.sa_flags = SA_RESTART | SA_SIGINFO; + sig_segv.sa_flags = SA_RESTART | SA_SIGINFO | SA_RESETHAND; #ifdef __PX4_CYGWIN // Do not catch SIGINT on Cygwin such that the process gets killed