From 04083cff3d9aee6a4178783a928969de1a370eab Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 7 Jun 2016 09:41:57 +0200 Subject: [PATCH] err: we need to use exit on NuttX px4_task_exit doesn't seem to be available for NuttX, so it had no effect and broke the init because the return values of the tasks were wrong. --- src/modules/systemlib/err.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/modules/systemlib/err.h b/src/modules/systemlib/err.h index d8f08fb4d5..76f59a8e1c 100644 --- a/src/modules/systemlib/err.h +++ b/src/modules/systemlib/err.h @@ -66,6 +66,7 @@ #define _SYSTEMLIB_ERR_H #include +#include #include #include #include "visibility.h" @@ -75,18 +76,22 @@ __BEGIN_DECLS __EXPORT const char *getprogname(void); -#include -#include +#ifdef __PX4_NUTTX +#define EXIT(eval) exit(eval) +#else +#define EXIT(eval) px4_task_exit(eval) +#endif + #define err(eval, ...) do { \ PX4_ERR(__VA_ARGS__); \ PX4_ERR("Task exited with errno=%i\n", errno); \ - px4_task_exit(eval); } \ - while(0) + EXIT(eval); \ + } while(0) #define errx(eval, ...) do { \ PX4_ERR(__VA_ARGS__); \ - px4_task_exit(eval); \ + EXIT(eval); \ } while(0) #define warn(...) PX4_WARN(__VA_ARGS__)