about summary refs log tree commit diff
path: root/elf/dl-error.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-error.c')
-rw-r--r--elf/dl-error.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 79ebaaf01b..0ef76c82ee 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -1,5 +1,5 @@
 /* Error handling for runtime dynamic linker.
-   Copyright (C) 1995-2002,2004,2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002,2004 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
@@ -19,7 +19,6 @@
 
 #include <libintl.h>
 #include <setjmp.h>
-#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -31,8 +30,6 @@ struct catch
   {
     const char *objname;	/* Object/File name.  */
     const char *errstring;	/* Error detail filled in here.  */
-    bool malloced;		/* Nonzero if the string is malloced
-				   by the libc malloc.  */
     jmp_buf env;		/* longjmp here on error.  */
   };
 
@@ -47,7 +44,8 @@ struct catch
 /* This message we return as a last resort.  We define the string in a
    variable since we have to avoid freeing it and so have to enable
    a pointer comparison.  See below and in dlfcn/dlerror.c.  */
-static const char _dl_out_of_memory[] = "out of memory";
+const char _dl_out_of_memory[] = "out of memory";
+INTVARDEF(_dl_out_of_memory)
 
 
 /* This points to a function which is called when an continuable error is
@@ -89,31 +87,17 @@ _dl_signal_error (int errcode, const char *objname, const char *occation,
 
       lcatch->errstring = (char *) malloc (len_objname + len_errstring);
       if (lcatch->errstring != NULL)
-	{
-	  /* Make a copy of the object file name and the error string.  */
-	  lcatch->objname = memcpy (__mempcpy ((char *) lcatch->errstring,
-					       errstring, len_errstring),
-				    objname, len_objname);
-
-	  /* If the main executable is relocated it means the libc's malloc
-	     is used.  */
-#ifdef SHARED
-	  lcatch->malloced = (GL(dl_ns)[LM_ID_BASE]._ns_loaded != NULL
-			      && (GL(dl_ns)[LM_ID_BASE]._ns_loaded->l_relocated
-				  != 0));
-#else
-	  lcatch->malloced = true;
-#endif
-	}
+	/* Make a copy of the object file name and the error string.  */
+	lcatch->objname = memcpy (__mempcpy ((char *) lcatch->errstring,
+					     errstring, len_errstring),
+				  objname, len_objname);
       else
 	{
 	  /* This is better than nothing.  */
 	  lcatch->objname = "";
-	  lcatch->errstring = _dl_out_of_memory;
-	  lcatch->malloced = false;
+	  lcatch->errstring = INTUSE(_dl_out_of_memory);
 	}
-      /* We do not restore the signal mask because none was saved.  */
-      __longjmp (lcatch->env[0].__jmpbuf, errcode ?: -1);
+      longjmp (lcatch->env, errcode ?: -1);
     }
   else
     {
@@ -156,7 +140,7 @@ _dl_signal_cerror (int errcode, const char *objname, const char *occation,
 int
 internal_function
 _dl_catch_error (const char **objname, const char **errstring,
-		 bool *mallocedp, void (*operate) (void *), void *args)
+		 void (*operate) (void *), void *args)
 {
   int errcode;
   struct catch *volatile old;
@@ -170,8 +154,7 @@ _dl_catch_error (const char **objname, const char **errstring,
 
   struct catch **const catchp = &CATCH_HOOK;
   old = *catchp;
-  /* Do not save the signal mask.  */
-  errcode = __sigsetjmp (c.env, 0);
+  errcode = setjmp (c.env);
   if (__builtin_expect (errcode, 0) == 0)
     {
       *catchp = &c;
@@ -179,7 +162,6 @@ _dl_catch_error (const char **objname, const char **errstring,
       *catchp = old;
       *objname = NULL;
       *errstring = NULL;
-      *mallocedp = false;
       return 0;
     }
 
@@ -187,7 +169,6 @@ _dl_catch_error (const char **objname, const char **errstring,
   *catchp = old;
   *objname = c.objname;
   *errstring = c.errstring;
-  *mallocedp = c.malloced;
   return errcode == -1 ? 0 : errcode;
 }