kern/103312: dlsym(NULL,) doesn't work properly
Dmitry Karasik
dmitry at karasik.eu.org
Sat Sep 16 05:40:21 PDT 2006
>Number: 103312
>Category: kern
>Synopsis: dlsym(NULL,) doesn't work properly
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Sep 16 12:40:19 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Dmitry Karasik
>Release: FreeBSD 6.1-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD tetsuo.karasik.eu.org 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #1: Fri Mar 31 20:36:29 CEST 2006 root at flow.eu.org:/data/obj/usr/src/sys/GENERIC i386
>Description:
man 3 dlsym states:
If dlsym() is called with the special handle NULL, it is interpreted as a
reference to the executable or shared object from which the call is being
made.
however, dlsym(NULL,) returns NULL always.
>How-To-Repeat:
#include <stdio.h>
#include <dlfcn.h>
#include <math.h>
int main()
{
void * ptr;
ptr = fabs;
printf("fabs: %x\n", fabs);
ptr = dlsym( NULL, "fabs");
if ( ptr) {
printf("dlsym(NULL,fabs)=%x\n", fabs);
} else {
printf("dlsym(NULL,fabs) error:%s\n", dlerror());
}
ptr = dlopen( NULL, RTLD_LOCAL);
printf("dlopen(NULL): %x\n", ptr);
ptr = dlsym( ptr, "fabs");
if ( ptr) {
printf("dlsym(dlopen(NULL),fabs)=%x\n", fabs);
} else {
printf("dlsym(dlopen(NULL),fabs) error:%s\n", dlerror());
}
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list