From 2b7630a8f3277a568695fc59996c8bad34261454 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 21 Aug 2013 17:32:35 -0700 Subject: [PATCH] Add a more useful error message if dlopen fails Previously, we were printing only the name of the library that we failed to open. Now, we also print the underlying cause for the failure, (as reported by dlerror). --- glaze-gl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glaze-gl.c b/glaze-gl.c index 0c2eada..b6e7d72 100644 --- a/glaze-gl.c +++ b/glaze-gl.c @@ -63,9 +63,11 @@ open_wrapper_handle (void) exit (1); } + dlerror (); wrapper_handle = dlopen (path, RTLD_LAZY); if (wrapper_handle == NULL) { - fprintf (stderr, "Error: Failed to dlopen %s\n", path); + const char *error = dlerror(); + fprintf (stderr, "Error: Failed to dlopen %s: %s\n", path, error); exit (1); } } -- 2.43.0