Skip to content
Snippets Groups Projects
Commit 385bc563 authored by Vivek Das Mohapatra's avatar Vivek Das Mohapatra
Browse files

_capsule_list: skip NULL elements (resulting from dlclose)

When a capsule is dlclose()d its entry in _capsule_list is set to
NULL: Code iterating over _capsule_list must skip such elements.
parent aea9ec73
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
......@@ -30,6 +30,10 @@ capsule_external_dlsym (void *handle, const char *symbol)
for( size_t n = 0; n < _capsule_list->next; n++ )
{
capsule cap = ptr_list_nth_ptr( _capsule_list, n );
if( !cap )
continue;
// TODO: If handle != cap->dl_handle, should we skip it?
// TODO: RTLD_NEXT isn't implemented (is it implementable?)
addr = _capsule_original_dlsym ( cap->dl_handle, symbol );
......@@ -94,6 +98,9 @@ capsule_external_dlopen(const char *file, int flag)
{
const capsule c = ptr_list_nth_ptr( _capsule_list, n );
if( !c )
continue;
if( _capsule_relocate( c, &error ) != 0 )
{
fprintf( stderr,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment