From e520d20700e513d69c5c83a03b48d89f4194fe63 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Tue, 14 Sep 2021 14:00:52 +0200 Subject: Close extraneous file descriptors to prevent an FD leak. After dup(2)ing an fd into another already existing fd, we can close the original. --- scsh-process.scm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scsh-process.scm') 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)) -- cgit v1.2.3