aboutsummaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorSilvio <silvio.traversaro@iit.it>2017-05-01 11:03:01 +0200
committerSilvio <silvio.traversaro@iit.it>2017-05-01 11:03:01 +0200
commit5bcd8c53987200107b28a76f4ef38d805e0f6d25 (patch)
tree0bfa491358554c77d14225b4d441323bbad9a8e0 /test.c
parent18195b170b636b10d30b4073f7bdecf6a331fc9d (diff)
downloaddlfcn-win32-5bcd8c53987200107b28a76f4ef38d805e0f6d25.tar.gz
dlfcn-win32-5bcd8c53987200107b28a76f4ef38d805e0f6d25.tar.bz2
dlfcn-win32-5bcd8c53987200107b28a76f4ef38d805e0f6d25.zip
Fix bug in dlerror second consecutive call
According to the specs, a second consecutive call to dlerror should always return NULL . This was the case in dlfcn-win32 before https://github.com/dlfcn-win32/dlfcn-win32/pull/20 introduce a regression that caused dlerror to crash on the second consecutive call. In this commit the issue is fixed as suggested in https://github.com/dlfcn-win32/dlfcn-win32/issues/34 and a regression test has been added.
Diffstat (limited to '')
-rw-r--r--test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test.c b/test.c
index 14523ad..ba440da 100644
--- a/test.c
+++ b/test.c
@@ -304,6 +304,21 @@ int main()
304 error = dlerror( ); 304 error = dlerror( );
305 printf( "SUCCESS\tCould not get nonexistent symbol from global handle: %s\n", 305 printf( "SUCCESS\tCould not get nonexistent symbol from global handle: %s\n",
306 error ? error : "" ); 306 error ? error : "" );
307
308 /* Test that the second call to dlerror() returns null as in the specs
309 See https://github.com/dlfcn-win32/dlfcn-win32/issues/34 */
310 error = dlerror( );
311 if( error == NULL )
312 {
313 printf( "SUCCESS\tSecond consecutive call to dlerror returned NULL\n");
314 }
315 else
316 {
317 printf( "ERROR\tSecond consecutive call to dlerror returned a non-NULL pointer: %p\n", error );
318 CLOSE_LIB;
319 CLOSE_GLOBAL;
320 RETURN_ERROR;
321 }
307 } 322 }
308 323
309 function = dlsym(global, "fwrite"); 324 function = dlsym(global, "fwrite");