1999-02-23  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>

	* elf/dl-error.c (_dl_signal_cerror): New function.
	(_dl_signal_error): Don't call receiver function.
	* elf/dl-lookup.c (_dl_lookup_symbol): Call _dl_signal_cerror
	instead of _dl_signal_error when reporting references to undefined
	symbols or versions.
	(_dl_lookup_versioned_symbol): Likewise.
	(_dl_lookup_versioned_symbol_skip): Likewise.
	* elf/dl-version.c (match_symbol): Likewise.

	* elf/ldsodefs.h: Declare _dl_signal_cerror.

	* misc/getttyent.c (getttyent): Release lock on stream later to
	also protect global variable zapchar.
This commit is contained in:
Ulrich Drepper 1999-02-22 18:05:04 +00:00
parent 69b3b3cb38
commit 3f933dc2ef
6 changed files with 84 additions and 43 deletions

View File

@ -1,5 +1,21 @@
1999-02-23 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* elf/dl-error.c (_dl_signal_cerror): New function.
(_dl_signal_error): Don't call receiver function.
* elf/dl-lookup.c (_dl_lookup_symbol): Call _dl_signal_cerror
instead of _dl_signal_error when reporting references to undefined
symbols or versions.
(_dl_lookup_versioned_symbol): Likewise.
(_dl_lookup_versioned_symbol_skip): Likewise.
* elf/dl-version.c (match_symbol): Likewise.
* elf/ldsodefs.h: Declare _dl_signal_cerror.
1999-02-22 Ulrich Drepper <drepper@cygnus.com>
* misc/getttyent.c (getttyent): Release lock on stream later to
also protect global variable zapchar.
* sysdeps/unix/sysv/linux/clock.c: Don't test return value of
__times [PR libc/990].

View File

@ -43,7 +43,7 @@ __libc_tsd_define (static, DL_ERROR)
#define tsd_setspecific(data) __libc_tsd_set (DL_ERROR, (data))
/* This points to a function which is called when an error is
/* This points to a function which is called when an continuable error is
received. Unlike the handling of `catch' this function may return.
The arguments will be the `errstring' and `objname'.
@ -84,13 +84,6 @@ _dl_signal_error (int errcode,
}
longjmp (lcatch->env, errcode ?: -1);
}
else if (receiver)
{
/* We are inside _dl_receive_error. Call the user supplied
handler and resume the work. The receiver will still be
installed. */
(*receiver) (errcode, objname, errstring);
}
else
{
/* Lossage while resolving the program's own symbols is always fatal. */
@ -105,6 +98,25 @@ _dl_signal_error (int errcode,
}
}
void
internal_function
_dl_signal_cerror (int errcode,
const char *objname,
const char *errstring)
{
if (receiver)
{
/* We are inside _dl_receive_error. Call the user supplied
handler and resume the work. The receiver will still be
installed. */
(*receiver) (errcode, objname, errstring);
}
else
_dl_signal_error (errcode, objname, errstring);
}
int
internal_function
_dl_catch_error (char **errstring,

View File

@ -96,7 +96,7 @@ _dl_lookup_symbol (const char *undef_name, const ElfW(Sym) **ref,
{
if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
/* We could find no value for a strong reference. */
_dl_signal_error (0, (reference_name && reference_name[0]
_dl_signal_cerror (0, (reference_name && reference_name[0]
? reference_name
: (_dl_argv[0] ?: "<main program>")),
make_string (undefined_msg, undef_name));
@ -199,9 +199,10 @@ _dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
break;
if (res < 0)
{
/* Oh, oh. The file named in the relocation entry does not
contain the needed symbol. */
_dl_signal_error (0, (reference_name && reference_name[0]
_dl_signal_cerror (0, (reference_name && reference_name[0]
? reference_name
: (_dl_argv[0] ?: "<main program>")),
make_string ("symbol ", undef_name, ", version ",
@ -211,13 +212,16 @@ _dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
" with link time reference",
res == -2
? " (no version symbols)" : ""));
*ref = NULL;
return 0;
}
}
if (current_value.s == NULL)
{
if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
/* We could find no value for a strong reference. */
_dl_signal_error (0, (reference_name && reference_name[0]
_dl_signal_cerror (0, (reference_name && reference_name[0]
? reference_name
: (_dl_argv[0] ?: "<main program>")),
make_string (undefined_msg, undef_name,
@ -281,7 +285,7 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
char buf[sizeof undefined_msg + len];
__mempcpy (__mempcpy (buf, undefined_msg, sizeof undefined_msg - 1),
undef_name, len + 1);
_dl_signal_error (0, (reference_name && reference_name[0]
_dl_signal_cerror (0, (reference_name && reference_name[0]
? reference_name
: (_dl_argv[0] ?: "<main program>")), buf);
}

View File

@ -93,7 +93,8 @@ match_symbol (const char *name, ElfW(Word) hash, const char *string,
object was linked against another version of this file. We
only print a message if verbose output is requested. */
if (verbose)
_dl_signal_error (0, map->l_name, make_string ("\
_dl_signal_cerror (0, map->l_name,
make_string ("\
no version information available (required by ",
name, ")"));
return 0;
@ -143,14 +144,14 @@ no version information available (required by ",
if (weak)
{
if (verbose)
_dl_signal_error (0, map->l_name,
_dl_signal_cerror (0, map->l_name,
make_string ("weak version `", string,
"' not found (required by ", name,
")"));
return 0;
}
_dl_signal_error (0, map->l_name,
_dl_signal_cerror (0, map->l_name,
make_string ("version `", string,
"' not found (required by ", name, ")"));
return 1;

View File

@ -208,6 +208,13 @@ extern void _dl_signal_error (int errcode,
internal_function
__attribute__ ((__noreturn__));
/* Like _dl_signal_error, but may return when called in the context of
_dl_receive_error. */
extern void _dl_signal_cerror (int errcode,
const char *object,
const char *errstring)
internal_function;
/* Call OPERATE, catching errors from `dl_signal_error'. If there is no
error, *ERRSTRING is set to null. If there is an error, *ERRSTRING is
set to a string constructed from the strings passed to _dl_signal_error,
@ -219,7 +226,7 @@ extern int _dl_catch_error (char **errstring,
void *args)
internal_function;
/* Call OPERATE, receiving errors from `dl_signal_error'. Unlike
/* Call OPERATE, receiving errors from `dl_signal_cerror'. Unlike
`_dl_catch_error' the operation is resumed after the OPERATE
function returns.
ARGS is passed as argument to OPERATE. */

View File

@ -93,7 +93,6 @@ getttyent()
if (*p && *p != '#')
break;
}
funlockfile(tf);
zapchar = 0;
tty.ty_name = p;
@ -124,6 +123,8 @@ getttyent()
else
break;
}
/* We can release the lock only here since `zapchar' is global. */
funlockfile(tf);
if (zapchar == '#' || *p == '#')
while ((c = *++p) == ' ' || c == '\t')