diff options
author | Chris Johns <chrisj@rtems.org> | 2017-03-28 17:23:05 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2017-04-04 13:26:01 +1000 |
commit | d2e31f70c12f6363cef79ffad781df6ec0acdfb5 (patch) | |
tree | 3ebf30b9233ccfbff397ef245f3b74f1f2bd69dd /cpukit/libdl/rtl-error.c | |
parent | dosfs: Fix file name search (diff) | |
download | rtems-d2e31f70c12f6363cef79ffad781df6ec0acdfb5.tar.bz2 |
libdl: Back port C++ exception throw and catch from 4.12.
Closes #2956.
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; +} |