From c7ee3d76f654e591e3a18f4c2de360cddf06e531 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 6 Jul 2021 06:54:26 -0700 Subject: streams: do not close stderr. * stream.c (stdio_close): Recognize stderr, not only stdin and stdout, as one of the streams not to be closed. This fixes situations when stderr is closed and exception handling tries to use it. --- stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream.c b/stream.c index 87eb3383..d32241bd 100644 --- a/stream.c +++ b/stream.c @@ -973,7 +973,7 @@ static val stdio_close(val stream, val throw_on_error) { struct stdio_handle *h = coerce(struct stdio_handle *, stream->co.handle); - if (h->f != 0 && h->f != stdin && h->f != stdout) { + if (h->f != 0 && h->f != stdin && h->f != stdout && h->f != stderr) { int result = fclose(h->f); h->f = 0; if (result == EOF && throw_on_error) { -- cgit v1.2.3