diff options
author | Chris Johns <chrisj@rtems.org> | 2016-12-07 17:20:38 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2016-12-14 09:07:16 +1100 |
commit | c6eead1353e03542e5bad9efda3b6553125520d8 (patch) | |
tree | f2495a17c8d001a8249b0e6f785c3428df721a1d /cpukit/libdl/rtl-error.c | |
parent | fe7012a0d1d71af20ae36d69c5bd6c31159457d9 (diff) |
libdl: Add C++ exception support to loaded modules.
This has been tested on SPARC, i386, PowerPC and ARM.
Closes #2767.
Diffstat (limited to 'cpukit/libdl/rtl-error.c')
-rw-r--r-- | cpukit/libdl/rtl-error.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/cpukit/libdl/rtl-error.c b/cpukit/libdl/rtl-error.c index 3251fa5392..5ec4b26ef7 100644 --- a/cpukit/libdl/rtl-error.c +++ b/cpukit/libdl/rtl-error.c @@ -17,6 +17,7 @@ #include "config.h" #endif +#include <errno.h> #include <stdio.h> #include <stdarg.h> @@ -39,9 +40,15 @@ int rtems_rtl_get_error (char* message, size_t max_message) { rtems_rtl_data_t* rtl = rtems_rtl_lock (); - int last_errno = rtl->last_errno; - strncpy (message, rtl->last_error, sizeof (rtl->last_error)); - rtems_rtl_unlock (); - return last_errno; -} + if (rtl != NULL) + { + int last_errno = rtl->last_errno; + strncpy (message, rtl->last_error, sizeof (rtl->last_error)); + rtems_rtl_unlock (); + return last_errno; + } + strncpy(message, "RTL init error", max_message); + + return EIO; +} |