Skip site navigation (1)Skip section navigation (2)
Date:      28 Mar 1997 15:24:28 -0000
From:      proff@suburbia.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/3131: <Synopsis of the problem (one line)> dlsym() does not set error on error, breaks dlerror()
Message-ID:  <19970328152428.6278.qmail@suburbia.net>
Resent-Message-ID: <199703281530.HAA15430@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3131
>Category:       bin
>Synopsis:       dlsym() does not set error on error, breaks dlerror()
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 28 07:30:01 PST 1997
>Last-Modified:
>Originator:     Julian Assange
>Organization:
>Release:        FreeBSD 2.2-GAMMA i386
>Environment:

	

>Description:

	dlerror() is meant to return the last error from dlopen or dlsym.

	dlsym() doesn't actually set any error message when an error
	happens. and thus dlerror() will lie

	

>How-To-Repeat:

	

>Fix:


--- src/gnu/usr.bin/ld/rtld/rtld.c.orig	Sun Feb  2 04:17:09 1997
+++ src/gnu/usr.bin/ld/rtld/rtld.c	Sat Mar 29 01:19:30 1997
@@ -27,7 +27,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  *	$Id: rtld.c,v 1.46 1997/02/22 15:46:48 peter Exp $
  */
 
 #include <sys/param.h>
@@ -1912,9 +1912,11 @@
 		src_map = smp;
 
 	np = lookup(sym, &src_map, 1);
-	if (np == NULL)
-		return NULL;
-
+	if (np == NULL) {
+			generror ("dlsym failed for \"%s\" : %s",
+				  smp->som_path, sym);
+			return NULL;
+	}
 	/* Fixup jmpslot so future calls transfer directly to target */
 	addr = np->nz_value;
 	if (src_map)
	
	

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970328152428.6278.qmail>