summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/core/panic.h2
-rw-r--r--src/panic.c9
2 files changed, 9 insertions, 2 deletions
diff --git a/include/osmocom/core/panic.h b/include/osmocom/core/panic.h
index 2bb4240b..c4006dc3 100644
--- a/include/osmocom/core/panic.h
+++ b/include/osmocom/core/panic.h
@@ -9,7 +9,7 @@
/*! panic handler callback function type */
typedef void (*osmo_panic_handler_t)(const char *fmt, va_list args);
-extern void osmo_panic(const char *fmt, ...);
+extern void osmo_panic(const char *fmt, ...) __attribute__ ((noreturn));
extern void osmo_set_panic_handler(osmo_panic_handler_t h);
/*! @} */
diff --git a/src/panic.c b/src/panic.c
index a08f89fa..072f458b 100644
--- a/src/panic.c
+++ b/src/panic.c
@@ -27,6 +27,7 @@
* @{
* \file panic.c */
+#include <unistd.h>
#include <osmocom/core/panic.h>
#include <osmocom/core/backtrace.h>
@@ -83,8 +84,14 @@ void osmo_panic(const char *fmt, ...)
osmo_panic_default(fmt, args);
va_end(args);
+
+ /* not reached, but make compiler believe we really never return */
+#ifndef PANIC_INFLOOP
+ exit(2342);
+#else
+ while (1) ;
+#endif
}
-
/*! Set the panic handler
* \param[in] h New panic handler function