From 9e2238f6cd6b7adcbbae34cd57473aef2138acdf Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 26 Jan 2019 11:39:05 -0600 Subject: [PATCH] libs/libc/dllfcn: Implement dlerror using strerror. --- libs/libc/dllfcn/lib_dlerror.c | 5 +++-- libs/libc/dllfcn/lib_dlsym.c | 4 ++-- libs/libc/dllfcn/lib_dlsymtab.c | 2 +- sched/module/mod_modsym.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/libc/dllfcn/lib_dlerror.c b/libs/libc/dllfcn/lib_dlerror.c index e4b5853e7b..3abbae7f38 100644 --- a/libs/libc/dllfcn/lib_dlerror.c +++ b/libs/libc/dllfcn/lib_dlerror.c @@ -39,7 +39,9 @@ #include +#include #include +#include /**************************************************************************** * Public Functions @@ -68,6 +70,5 @@ FAR char *dlerror(void) { -#warning Missing logic - return NULL; + return (FAR char *)strerror(errno); } \ No newline at end of file diff --git a/libs/libc/dllfcn/lib_dlsym.c b/libs/libc/dllfcn/lib_dlsym.c index e823f37a83..4f4a792c46 100644 --- a/libs/libc/dllfcn/lib_dlsym.c +++ b/libs/libc/dllfcn/lib_dlsym.c @@ -101,12 +101,12 @@ static inline FAR const void *dlgetsym(FAR void *handle, modp->modinfo.nexports); if (symbol == NULL) { - serr("ERROR: Failed to find symbol in symbol \"$s\" in table\n", name); + serr("ERROR: Failed to find symbol in symbol \"%s\" in table\n", name); err = ENOENT; goto errout_with_lock; } - /* Return the address within the module assoicated with the symbol */ + /* Return the address within the module associated with the symbol */ modlib_registry_unlock(); DEBUGASSERT(symbol->sym_value != NULL); diff --git a/libs/libc/dllfcn/lib_dlsymtab.c b/libs/libc/dllfcn/lib_dlsymtab.c index 259366f60b..be0334ae02 100644 --- a/libs/libc/dllfcn/lib_dlsymtab.c +++ b/libs/libc/dllfcn/lib_dlsymtab.c @@ -54,7 +54,7 @@ * * Description: * dlsymtab() is a non-standard shared library interface. It selects the - * symbol table to use when binding a shared libary to the base firmware + * symbol table to use when binding a shared library to the base firmware * which may be in FLASH memory. * * Input Parameters: diff --git a/sched/module/mod_modsym.c b/sched/module/mod_modsym.c index 6eb4950404..8ec196343f 100644 --- a/sched/module/mod_modsym.c +++ b/sched/module/mod_modsym.c @@ -118,7 +118,7 @@ FAR const void *modsym(FAR void *handle, FAR const char *name) goto errout_with_lock; } - /* Return the address within the module assoicated with the symbol */ + /* Return the address within the module associated with the symbol */ modlib_registry_unlock(); DEBUGASSERT(symbol->sym_value != NULL);