diff options
author | Silvio <silvio.traversaro@iit.it> | 2017-05-01 11:03:01 +0200 |
---|---|---|
committer | Silvio <silvio.traversaro@iit.it> | 2017-05-01 11:03:01 +0200 |
commit | 5bcd8c53987200107b28a76f4ef38d805e0f6d25 (patch) | |
tree | 0bfa491358554c77d14225b4d441323bbad9a8e0 /dlfcn.c | |
parent | 18195b170b636b10d30b4073f7bdecf6a331fc9d (diff) | |
download | dlfcn-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 'dlfcn.c')
-rw-r--r-- | dlfcn.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -431,6 +431,12 @@ end: | |||
431 | char *dlerror( void ) | 431 | char *dlerror( void ) |
432 | { | 432 | { |
433 | char *error_pointer = dlerror_buffer; | 433 | char *error_pointer = dlerror_buffer; |
434 | |||
435 | /* If this is the second consecutive call to dlerror, return NULL */ | ||
436 | if (current_error == NULL) | ||
437 | { | ||
438 | return NULL; | ||
439 | } | ||
434 | 440 | ||
435 | #ifdef UNICODE | 441 | #ifdef UNICODE |
436 | errno_t err = 0; | 442 | errno_t err = 0; |