Date: Sat, 16 Sep 2006 14:32:43 +0200 (CEST) From: Dmitry Karasik <dmitry@karasik.eu.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/103312: dlsym(NULL,) doesn't work properly Message-ID: <20060916123243.7DF9239C99E@tetsuo.karasik.eu.org> Resent-Message-ID: <200609161240.k8GCeKpj088427@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060916123243.7DF9239C99E>