summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-06 06:54:26 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-06 06:54:26 -0700
commita9a4870f8d3971f907abb9e85759326a38322b44 (patch)
treed3497a228a1b816dc115e86a9a8c7290fc330abd
parenta6857c613efe6a0b54deb5daa0dc3234d5d86b57 (diff)
downloadtxr-a9a4870f8d3971f907abb9e85759326a38322b44.tar.gz
txr-a9a4870f8d3971f907abb9e85759326a38322b44.tar.bz2
txr-a9a4870f8d3971f907abb9e85759326a38322b44.zip
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.
-rw-r--r--stream.c2
1 files changed, 1 insertions, 1 deletions
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) {