diff --git a/libs/libc/assert/lib_assert.c b/libs/libc/assert/lib_assert.c index 5ff55c86a3..97bb7517b5 100644 --- a/libs/libc/assert/lib_assert.c +++ b/libs/libc/assert/lib_assert.c @@ -27,6 +27,16 @@ #include #include +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* If assert() is called from kernel, must not call user API abort */ + +#ifdef __KERNEL__ +# define abort PANIC +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -34,5 +44,5 @@ void __assert(FAR const char *filename, int linenum, FAR const char *msg) { _assert(filename, linenum, msg); - exit(EXIT_FAILURE); + abort(); }