This is the mail archive of the libc-alpha@sources.redhat.com 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]

Re: A patch for elf/dl-deps.c


On Tue, Apr 10, 2001 at 06:57:06PM +0200, Jakub Jelinek wrote:
> On Mon, Apr 09, 2001 at 12:16:18PM -0700, H . J . Lu wrote:
> > We should preserve the real error message.
> 
> That looks very unsafe to me, try testing glibc with your patch under
> efence.
> E.g.:
>                     if (_dl_catch_error (&objname, &errstring, openaux, &args))
>                       {
>                         /* We are not interested in the error message.  */
>                         assert (errstring != NULL);
>                         if (errstring != _dl_out_of_memory)
>                           free ((char *) errstring);
> 
> will surely not end up with valid errstring.
> 

Ooops. Here is the new patch.

Thanks.


H.J.
---
2001-04-10  H.J. Lu  <hjl@gnu.org>

	* elf/dl-deps.c (_dl_map_object_deps): Preserve the original
	error message.

--- elf/dl-deps.c.error	Tue Feb 27 22:22:09 2001
+++ elf/dl-deps.c	Tue Apr 10 10:09:56 2001
@@ -145,6 +145,7 @@ _dl_map_object_deps (struct link_map *ma
   const char *name;
   int errno_saved;
   int errno_reason;
+  const char *errstring = NULL;
 
   auto inline void preload (struct link_map *map);
 
@@ -236,7 +237,6 @@ _dl_map_object_deps (struct link_map *ma
 		/* Allocate new entry.  */
 		struct list *newp;
 		const char *objname;
-		const char *errstring;
 
 		/* Recognize DSTs.  */
 		name = expand_dst (l, strtab + d->d_un.d_val, 0);
@@ -581,5 +581,6 @@ out:
 
   if (errno_reason)
     _dl_signal_error (errno_reason == -1 ? 0 : errno_reason,
-		      name ?: "", N_("cannot load shared object file"));
+		      name ?: "",
+		      errstring ?: N_("cannot load shared object file"));
 }


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