Date: Tue, 11 May 2021 22:51:48 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 255698] dlerror() returns non-NULL after a successful call to dlopen()/dlsym() Message-ID: <bug-255698-227-fuBgxQ8JKu@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-255698-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255698 --- Comment #5 from Eugene M. Kim <astralblue@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.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-255698-227-fuBgxQ8JKu>
