summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-11-10 21:46:25 +0100
committerJo-Philipp Wich <jo@mein.io>2020-11-10 21:46:53 +0100
commit6893c896561387fa88f610a2f54ba59867021cd8 (patch)
tree0965f6496e5373b7412493322e2e53a1dc1d5b4b
parent2ad1eb5296daea031aa0765caeb86f25c527120a (diff)
fs: do not close stdio streams when gc'ing scope
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--lib/fs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/fs.c b/lib/fs.c
index f8888c5..261094e 100644
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -710,7 +710,10 @@ static void close_proc(void *ud) {
}
static void close_file(void *ud) {
- fclose((FILE *)ud);
+ FILE *fp = ud;
+
+ if (fp != stdin && fp != stdout && fp != stderr)
+ fclose(fp);
}
static void close_dir(void *ud) {