summaryrefslogtreecommitdiff
path: root/elf/dl-error.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-12 17:26:19 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-12 17:26:19 +0000
commit8d9618b7f6ecbcd04fd572140bbecaf9be10d376 (patch)
treece9f6b373142f8875c9d6a4543e20c732afab18a /elf/dl-error.c
parenteb13b9a02d939ee7440472c5a5f86e55f3adbd54 (diff)
Update.
1998-03-12 13:11 Tim Waugh <tim@cyberelk.demon.co.uk> * posix/wordexp-test.c: More tests. (main): Set up arena for pathname expansion tests (in a temporary directory). (testit): Don't check word count or word vector if return value is non-zero. * posix/wordexp.c (exec_comm): Always chop off terminating linefeed (just like bash does). (parse_param): Change lots of occurrences of "if (!*env)" to "if (!env || !*env)". (parse_param): For assignment inside parameter expansion, use all expanded words in assignment rather than just the first. (parse_param): Corrected return value for parameter expansion of an unset variable when WRDE_UNDEF is in effect. (parse_dollars): Don't field-split if quoted. (wordexp): Opening brace character isn't allowed unquoted. 1998-03-12 Ulrich Drepper <drepper@cygnus.com> * elf/dlerror.c: Fix concurrency problems with error string and number. * elf/dl-deps.c (_dl_map_object_deps): Print debug info when filter/auxiliary are being loaded. 1998-03-12 14:24 Ulrich Drepper <drepper@cygnus.com> * elf/dlerror.c (last_object_name): Removed. (dlerror): Don't use last_object_name. (_dl_error_run): Omit second argument to _dl_catch_error. * elf/dl-error.c (struct catch): Remove objname member. (_dl_signal_error): Construct string including objname when given. (_dl_catch_error): Remove objname handling. * elf/link.h (_dl_catch_error): Fix prototype and comment. * elf/rtld.c (dl_main): Call _dl_catch_error correctly. * elf/dl-deps.c (_dl_map_objet_deps): Likewise. * nss/nsswitch.c (nss_dlerror_run): Likewise. * iconv/gconv_dl.c (dlerror_run): Likewise. [Corrects PR libc/501].
Diffstat (limited to 'elf/dl-error.c')
-rw-r--r--elf/dl-error.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 6945ea82be..5b4c0a3108 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -31,7 +31,6 @@ extern char *_strerror_internal __P ((int, char *, size_t));
struct catch
{
char *errstring; /* Error detail filled in here. */
- const char *objname;
jmp_buf env; /* longjmp here on error. */
};
@@ -59,11 +58,18 @@ _dl_signal_error (int errcode,
/* We are inside _dl_catch_error. Return to it. We have to
duplicate the error string since it might be allocated on the
stack. */
- size_t len = strlen (errstring) + 1;
- catch->errstring = malloc (len);
+ size_t objname_len = objname ? strlen (objname) + 2 : 0;
+ size_t errstring_len = strlen (errstring) + 1;
+ catch->errstring = malloc (objname_len + errstring_len);
if (catch->errstring != NULL)
- memcpy (catch->errstring, errstring, len);
- catch->objname = objname;
+ {
+ if (objname_len > 0)
+ {
+ memcpy (catch->errstring, objname, objname_len - 2);
+ memcpy (catch->errstring + objname_len - 2, ": ", 2);
+ }
+ memcpy (catch->errstring + objname_len, errstring, errstring_len);
+ }
longjmp (catch->env, errcode ?: -1);
}
else if (receiver)
@@ -89,7 +95,6 @@ _dl_signal_error (int errcode,
int
_dl_catch_error (char **errstring,
- const char **objname,
void (*operate) (void *),
void *args)
{
@@ -101,7 +106,6 @@ _dl_catch_error (char **errstring,
/* Some systems (e.g., SPARC) handle constructors to local variables
inefficient. So we initialize `c' by hand. */
c.errstring = NULL;
- c.objname = NULL;
old = catch;
errcode = setjmp (c.env);
@@ -111,14 +115,12 @@ _dl_catch_error (char **errstring,
(*operate) (args);
catch = old;
*errstring = NULL;
- *objname = NULL;
return 0;
}
/* We get here only if we longjmp'd out of OPERATE. */
catch = old;
*errstring = c.errstring;
- *objname = c.objname;
return errcode == -1 ? 0 : errcode;
}