mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
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.
This commit is contained in:
23
elf/dl-sym.c
23
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user