[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Problem using dlopen
On Tue, Jan 06, 2009 at 01:10:25PM -0600, David Dudley wrote:
> At line 319 of the function, a call is made to dlopen to load the
> files (one by one) from nsswitch.conf. Those calls all fail, as there
> are no libraries to load (being all internal).
> At this point, there is an error code stored by the loader saying that
> it can't find the library (in my case "nss_dns.so.0"). That error
> code is not cleared before exiting the nsdispatch routine, so of
> course, it still exists when dlopen returns.
Error returns (errno normally but I guess dlerror() here) should never
be examined unless a previous system/library call actually returned an
error. This is basic unix programming, expecting errno/whatever to
always be 0 on a successful system call is bad practice and highly
implementation dependent as you have found.
> Seems to me, the fix is to make a call to dlerror() at line 328, right
> before the "goto out" line.
The correct fix is, I suspect, that you only call dlerror() if one of
the other dlxxxx() functions returns an error. You don't need to
worry about doing this in the case of dlopen() as the man page says
the program will be terminated if dlopen() fails.
The information contained in this email and any attached files is
confidential to BAE Systems Australia. If you are not the intended
recipient, any use, disclosure or copying of this email or any
attachments is expressly prohibited. If you have received this email
in error, please notify us immediately. VIRUS: Every care has been
taken to ensure this email and its attachments are virus free,
however, any loss or damage incurred in using this email is not the
sender's responsibility. It is your responsibility to ensure virus
checks are completed before installing any data sent in this email to
Main Index |
Thread Index |