From 5812a26eeb8928f34eadc5c5dfca74563a824cd0 Mon Sep 17 00:00:00 2001 From: Patrick Gauvin Date: Sun, 26 Jun 2016 13:06:07 -0400 Subject: Update dlerror usage Handles possible NULL return value Updates #2747 --- cpukit/libdl/dlfcn-shell.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cpukit') 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; } -- cgit v1.2.3