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> 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 * sysdeps/unix/sysv/linux/clock.c: Don't test return value of
__times [PR libc/990]. __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)) #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. received. Unlike the handling of `catch' this function may return.
The arguments will be the `errstring' and `objname'. The arguments will be the `errstring' and `objname'.
@ -84,13 +84,6 @@ _dl_signal_error (int errcode,
} }
longjmp (lcatch->env, errcode ?: -1); 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 else
{ {
/* Lossage while resolving the program's own symbols is always fatal. */ /* 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 int
internal_function internal_function
_dl_catch_error (char **errstring, _dl_catch_error (char **errstring,

View File

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

View File

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

View File

@ -208,6 +208,13 @@ extern void _dl_signal_error (int errcode,
internal_function internal_function
__attribute__ ((__noreturn__)); __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 /* 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 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, 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) void *args)
internal_function; 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 `_dl_catch_error' the operation is resumed after the OPERATE
function returns. function returns.
ARGS is passed as argument to OPERATE. */ ARGS is passed as argument to OPERATE. */

View File

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