This is the mail archive of the glibc-bugs@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]

[Bug dynamic-link/14989] dlerror() returns garbage


http://sourceware.org/bugzilla/show_bug.cgi?id=14989

Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA at GMail dot Com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |
     Ever Confirmed|1                           |0

--- Comment #2 from Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA at GMail dot Com> 2012-12-31 09:18:23 UTC ---
Failure of second dlclose() is expected. This bug is about wrong library name
in message returned by dlerror(). dlerror() returns correct name of library in
case of libc.so.6, but not in case of majority of other libraries.

$ cat dlerror_test.c
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char** argv)
{
  int i;
  for (i = 1; i < argc; i++)
  {
    char buffer[1024];
    snprintf(buffer, 1024, "%s:", argv[i]);
    printf("%-20s", buffer);
    void* handle = dlopen(argv[i], RTLD_NOW);
    if (handle)
    {
      dlclose(handle);
      dlclose(handle);
      printf("dlerror() after double dlclose() : ");
    }
    else
    {
      printf("dlerror() after dlopen()  : ");
    }
    printf("'%s'\n", dlerror());
  }
}
$ gcc -o dlerror_test dlerror_test.c -ldl
$ ./dlerror_test libncurses.so.5 libreadline.so.6 libz.so.1 libc.so.6
libncurses.so.5:    dlerror() after double dlclose() : '0%>: shared object not
open'
libreadline.so.6:   dlerror() after double dlclose() : '*>: shared object not
open'
libz.so.1:          dlerror() after double dlclose() : 'P%>: shared object not
open'
libc.so.6:          dlerror() after double dlclose() : '/lib64/libc.so.6:
shared object not open'

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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