about summary refs log tree commit diff
path: root/elf/dlsym.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-02-03 10:30:07 +0000
committerUlrich Drepper <drepper@redhat.com>1999-02-03 10:30:07 +0000
commit649ad05add7f3f69a62b2ee929582a531f59cfd9 (patch)
treef35e42ed65d1db09089ad6d810be2cda15fb5027 /elf/dlsym.c
parentf549233427db72d1f3f51a1d4bca548361231b46 (diff)
downloadglibc-649ad05add7f3f69a62b2ee929582a531f59cfd9.tar.gz
glibc-649ad05add7f3f69a62b2ee929582a531f59cfd9.tar.xz
glibc-649ad05add7f3f69a62b2ee929582a531f59cfd9.zip
Update.
1999-02-03  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dlsym.c (dlsym_doit): If no symbol for RTLD_NEXT is found
	initialize ref element of args object so that dlsym does not dump
	a core.
	* elf/dlvsym.c (dlvsym_doit): Likewise.
Diffstat (limited to 'elf/dlsym.c')
-rw-r--r--elf/dlsym.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/elf/dlsym.c b/elf/dlsym.c
index 64d0cabbd4..5753f54d6e 100644
--- a/elf/dlsym.c
+++ b/elf/dlsym.c
@@ -1,5 +1,5 @@
 /* Look up a symbol in a shared object loaded by `dlopen'.
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -65,6 +65,16 @@ RTLD_NEXT used in code not dynamically loaded"));
 
       args->loadbase = _dl_lookup_symbol_skip (args->name, &args->ref,
 					       l->l_local_scope, NULL, match);
+
+      if (args->loadbase == 0)
+	{
+	  /* This means that no such symbol is defined.  In this case we
+	     have to provide a phony Elfxx_Sym entry since the value is
+	     referenced in `dlsym'.  */
+	  static const ElfW(Sym) null_result;
+
+	  args->ref = &null_result;
+	}
     }
   else
     {