mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
Make scm_gc_warn_proc() write directly to stderr
This avoids a deadlock due to the lookup of cur_warnport_fluid while an allocation is ongoing. * libguile/gc.c (scm_gc_warn_proc): Write the warning directly to stderr.
This commit is contained in:
parent
6dd87f4d8c
commit
37551e40b8
1 changed files with 3 additions and 31 deletions
|
@ -105,37 +105,9 @@ scm_oom_fn (size_t nbytes)
|
||||||
static void
|
static void
|
||||||
scm_gc_warn_proc (char *fmt, GC_word arg)
|
scm_gc_warn_proc (char *fmt, GC_word arg)
|
||||||
{
|
{
|
||||||
SCM port;
|
/* avoid scm_current_warning_port() b/c the GC lock is already taken
|
||||||
FILE *stream = NULL;
|
and the fluid ref might require it */
|
||||||
|
fprintf (stderr, fmt, arg);
|
||||||
port = scm_current_warning_port ();
|
|
||||||
if (!SCM_OPPORTP (port))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (SCM_FPORTP (port))
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
scm_force_output (port);
|
|
||||||
if (!SCM_OPPORTP (port))
|
|
||||||
return;
|
|
||||||
fd = dup (SCM_FPORT_FDES (port));
|
|
||||||
if (fd == -1)
|
|
||||||
perror ("Failed to dup warning port fd");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
stream = fdopen (fd, "a");
|
|
||||||
if (!stream)
|
|
||||||
{
|
|
||||||
perror ("Failed to open stream for warning port");
|
|
||||||
close (fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (stream ? stream : stderr, fmt, arg);
|
|
||||||
|
|
||||||
if (stream)
|
|
||||||
fclose (stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue