diff options
author | Patrick Gauvin <gauvin@hcs.ufl.edu> | 2016-06-26 13:06:07 -0400 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2018-02-08 14:21:13 +1100 |
commit | 5812a26eeb8928f34eadc5c5dfca74563a824cd0 (patch) | |
tree | a9e6af597525f7ac5c819953f71788aeb0f1ca84 /cpukit/libdl | |
parent | libdl: Fix dlerror return type (diff) | |
download | rtems-5812a26eeb8928f34eadc5c5dfca74563a824cd0.tar.bz2 |
Update dlerror usage
Handles possible NULL return value
Updates #2747
Diffstat (limited to '')
-rw-r--r-- | cpukit/libdl/dlfcn-shell.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cpukit/libdl/dlfcn-shell.c b/cpukit/libdl/dlfcn-shell.c index 3746711ef1..12c737abb6 100644 --- a/cpukit/libdl/dlfcn-shell.c +++ b/cpukit/libdl/dlfcn-shell.c @@ -38,7 +38,8 @@ convert_ascii_to_voidp (const char* arg) int shell_dlopen (int argc, char* argv[]) { - int arg; + int arg; + char *err; for (arg = 1; arg < argc; arg++) { void* handle = dlopen (argv[arg], RTLD_NOW | RTLD_GLOBAL); @@ -53,7 +54,10 @@ shell_dlopen (int argc, char* argv[]) printf ("handle: %p %s\n", handle, message); } else - printf ("error: %s\n", dlerror ()); + { + err = dlerror (); + printf ("error: %s\n", err ? err : ""); + } } return 0; } |