mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Fix stack overflow if printing a pre-boot error throws an error
* libguile/throw.c (scm_throw): Fall back to fprintf if all is lost.
This commit is contained in:
parent
a12e862bec
commit
2fbc38f0d0
1 changed files with 14 additions and 5 deletions
|
@ -243,11 +243,20 @@ scm_throw (SCM key, SCM args)
|
||||||
{
|
{
|
||||||
SCM throw = scm_variable_ref (throw_var);
|
SCM throw = scm_variable_ref (throw_var);
|
||||||
if (scm_is_false (throw)) {
|
if (scm_is_false (throw)) {
|
||||||
SCM port = scm_current_error_port ();
|
static int error_printing_error = 0;
|
||||||
scm_puts ("Pre-boot error; key: ", port);
|
if (error_printing_error++)
|
||||||
scm_write (key, port);
|
{
|
||||||
scm_puts (", args: ", port);
|
fprintf (stderr, "Error while printing pre-boot error: %s\n",
|
||||||
scm_write (args, port);
|
scm_i_symbol_chars (key));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCM port = scm_current_error_port ();
|
||||||
|
scm_puts ("Pre-boot error; key: ", port);
|
||||||
|
scm_write (key, port);
|
||||||
|
scm_puts (", args: ", port);
|
||||||
|
scm_write (args, port);
|
||||||
|
}
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
scm_apply_1 (throw, key, args);
|
scm_apply_1 (throw, key, args);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue