summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/utils.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-06-28 09:24:17 +0200
committerHarald Welte <laforge@gnumonks.org>2018-06-28 10:57:42 +0200
commit459a180877d410d491d7adb1fdf9cc12fd51ac99 (patch)
treeea1b41ecefa460b5fa933b1a585cc99a63714977 /include/osmocom/core/utils.h
parent79d49af93a45f184ad05ab6dc4fd662848333e50 (diff)
Don't call abort() directly, always use osmo_panic()
A loooong time ago, we introduced osmo_panic() as a wrapper around abort(). The advantage is, that this wrapper can be overridden, and that it will also work in embedded (bare iron) targets, where the abort simply translates to an infinite loop. Change-Id: I5a70eb65952cbc329bf96eacb428b07a9da32433
Diffstat (limited to 'include/osmocom/core/utils.h')
-rw-r--r--include/osmocom/core/utils.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index cd22dfb0..dd4461cc 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -4,6 +4,7 @@
#include <osmocom/core/backtrace.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/panic.h>
/*! \defgroup utils General-purpose utility functions
* @{
@@ -77,9 +78,7 @@ do { \
*/
#define OSMO_ASSERT(exp) \
if (!(exp)) { \
- fprintf(stderr, "Assert failed %s %s:%d\n", #exp, __BASE_FILE__, __LINE__); \
- osmo_generate_backtrace(); \
- abort(); \
+ osmo_panic("Assert failed %s %s:%d\n", #exp, __BASE_FILE__, __LINE__); \
}
/*! duplicate a string using talloc and release its prior content (if any)