summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorPatrick Gauvin <gauvin@hcs.ufl.edu>2016-06-26 13:06:07 -0400
committerChris Johns <chrisj@rtems.org>2018-02-08 14:21:13 +1100
commit5812a26eeb8928f34eadc5c5dfca74563a824cd0 (patch)
treea9e6af597525f7ac5c819953f71788aeb0f1ca84 /cpukit
parentdc746b50cadae8f367ed3da1b35682ab920e360f (diff)
downloadrtems-5812a26eeb8928f34eadc5c5dfca74563a824cd0.tar.bz2
Update dlerror usage
Handles possible NULL return value Updates #2747
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libdl/dlfcn-shell.c8
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;
}