[Bug 256105] dlerror(3) returns an empty string

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 23 May 2021 18:18:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256105

            Bug ID: 256105
           Summary: dlerror(3) returns an empty string
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: yuri@freebsd.org
 Attachment #225202 text/plain
         mime type:

Created attachment 225202
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=225202&action=edit
dlerror-return.c

The attached program prints this:
> after dlopen of '/usr/lib/libutil.so' dlerror: p=0x800222760 s='' s[0]=0

dlerror(3) returns an empty, zero-terminated string.

The manpage says that it returns null pointer when no error has occurred:
>      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.  At each call
>      to dlerror(), the error indication is reset.  Thus in the case of two
>      calls to dlerror(), where the second call follows the first immediately,
>      the second call will always return a null pointer.

Was the behavior changes?

I found this problem while investigating why the Jack audio server (audio/jack)
now fails to start with:
> could not find any drivers in /usr/local/lib/jack!

This is because its test for errors fails because of the above.

-- 
You are receiving this mail because:
You are the assignee for the bug.