This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Detecting dlclose() on an already closed handle?


On 12/22/2016 11:56 AM, Carlos O'Donell wrote:
> POSIX says:
> ~~~
> If the referenced symbol table handle was successfully closed, dlclose() 
> shall return 0. If handle does not refer to an open symbol table handle 
> or if the symbol table handle could not be closed, dlclose() shall 
> return a non-zero value. More detailed diagnostic information shall 
> be available through dlerror().
> ~~~

I read too much into this.

The only thing the text guarantees is that the handle currently points to
an open symbol table (loaded library) and we don't care if it originally
referenced a different library due to handle reuse.

Therefore the only solution being forced is that the implementation must
maintain a list of open objects. We already do that for dlopen/dlclose.
Where it's costly is dlsym where you have to do handle validation.

Therefore I think we can fix this without much trouble.

-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]