[Bug 255698] dlerror() returns non-NULL after a successful call to dlopen()/dlsym()
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue May 11 22:51:48 UTC 2021
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255698
--- Comment #5 from Eugene M. Kim <astralblue at gmail.com> ---
Hi Konstantin, thank you for fixing this! I rebuilt my world and the dltest
program now outputs this:
dlerror()=0x8002227f0 ()
dlerror()=0x0
dlopen(/foobar.so, RTLD_NOW)=0x0
dlerror()=0x8002227f0 (Cannot open "/foobar.so")
dlerror()=0x0
dlopen(/usr/lib/libm.so, RTLD_NOW)=0x800226808
dlerror()=0x0
dlerror()=0x0
This is very close to the expected output, except the first call to dlerror()
still returns a non-NULL (albeit empty) message, instead of NULL. The wording
of dlerror(3) makes me believe that returning NULL is more appropriate in this
case: "The dlerror() function returns a null-terminated character string
describing the last error that occurred during a call to dlopen(), dladdr(),
dlinfo(), dlsym(), dlvsym(), dlfunc(), or dlclose(). If no such error has
occurred, dlerror() returns a null pointer."
>From practical POV, your fix does address the use case where callers check for
errors using dlerror() == NULL, as such checks always occur after a call to one
of those other functions.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list