summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2021-09-14 14:00:52 +0200
committerPeter Bex <peter@more-magic.net>2021-09-14 14:00:52 +0200
commite520d20700e513d69c5c83a03b48d89f4194fe63 (patch)
tree253a87c839dea567c6d9ed7d6a621ebd66427ddf
parenteb97f7d4f6a6428b52f6cd24e54d3e4650f631a0 (diff)
downloadscsh-process-master.tar.gz
Close extraneous file descriptors to prevent an FD leak.HEADmaster
After dup(2)ing an fd into another already existing fd, we can close the original.
-rw-r--r--scsh-process.scm2
1 files changed, 2 insertions, 0 deletions
diff --git a/scsh-process.scm b/scsh-process.scm
index a6d6e0b..af3586e 100644
--- a/scsh-process.scm
+++ b/scsh-process.scm
@@ -364,6 +364,7 @@
(lambda ()
(file-close in)
(duplicate-fileno out 1)
+ (file-close out)
(with-output-to-port (open-output-file* 1) thunk)))))
(file-close out)
(open-input-file* in)))
@@ -377,6 +378,7 @@
perm/irgrp perm/iwgrp
perm/iroth perm/iwoth))))
(duplicate-fileno fd 1)
+ (file-close fd)
(with-output-to-port (open-output-file* 1) thunk)))))
temp-file))