aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-sym.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-08-10 13:40:22 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-08-10 16:54:57 +0200
commit2449ae7b2da24c9940962304a3e44bc80e389265 (patch)
treec2cfdcfc3a90731d2da26dda79984eda95e9079e /elf/dl-sym.c
parentf87cc2bfba9b844da48a63441c6099342b1551c7 (diff)
downloadglibc-2449ae7b2da24c9940962304a3e44bc80e389265.zip
glibc-2449ae7b2da24c9940962304a3e44bc80e389265.tar.gz
glibc-2449ae7b2da24c9940962304a3e44bc80e389265.tar.bz2
ld.so: Introduce struct dl_exception
This commit separates allocating and raising exceptions. This simplifies catching and re-raising them because it is no longer necessary to make a temporary, on-stack copy of the exception message.
Diffstat (limited to 'elf/dl-sym.c')
-rw-r--r--elf/dl-sym.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/elf/dl-sym.c b/elf/dl-sym.c
index 7cd6e97..fb54a91 100644
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -119,26 +119,11 @@ do_sym (void *handle, const char *name, void *who,
args.refp = &ref;
THREAD_GSCOPE_SET_FLAG ();
-
- const char *objname;
- const char *errstring = NULL;
- bool malloced;
- int err = _dl_catch_error (&objname, &errstring, &malloced,
- call_dl_lookup, &args);
-
+ struct dl_exception exception;
+ int err = _dl_catch_exception (&exception, call_dl_lookup, &args);
THREAD_GSCOPE_RESET_FLAG ();
-
- if (__glibc_unlikely (errstring != NULL))
- {
- /* The lookup was unsuccessful. Rethrow the error. */
- char *errstring_dup = strdupa (errstring);
- char *objname_dup = strdupa (objname);
- if (malloced)
- free ((char *) errstring);
-
- _dl_signal_error (err, objname_dup, NULL, errstring_dup);
- /* NOTREACHED */
- }
+ if (__glibc_unlikely (exception.errstring != NULL))
+ _dl_signal_exception (err, &exception, NULL);
result = args.map;
}