Show "(null)" in error message when passed filname to dlopen() was NULL and error occurred It does not make sense to pass file variable (which is NULL) to function save_err_ptr_str() which converts its argument to string. We can call directly save_err_str() with string value. Also it is highly unexpected that GetModuleHandle(NULL) call fails.
diff --git a/dlfcn.c b/dlfcn.c
index e13c631..2497a39 100644
--- a/dlfcn.c
+++ b/dlfcn.c
@@ -233,7 +233,7 @@ void *dlopen( const char *file, int mode )
hModule = GetModuleHandle( NULL );
if( !hModule )
- save_err_ptr_str( file );
+ save_err_str( "(null)" );
}
else
{