commit f22695bc446baeb1bff9e1bd5e17009e0c7f9bae
parent ff71c39401e053a56543840a536d37efaff96fc0
Author: Joe Finney <me@spxtr.net>
Date: Fri, 24 Mar 2023 10:05:11 -0700
Fix fd leak in os::exec::platform_start.
Signed-off-by: Joe Finney <me@spxtr.net>
Diffstat:
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/os/exec/exec+freebsd.ha b/os/exec/exec+freebsd.ha
@@ -171,6 +171,7 @@ fn platform_start(cmd: *command) (process | errors::error) = {
return errors::errno(err);
case let pid: int =>
rt::close(pipe[1])!;
+ defer rt::close(pipe[0])!;
let errno: int = 0;
match (rt::read(pipe[0], &errno, size(int))) {
case let err: rt::errno =>
diff --git a/os/exec/exec+linux.ha b/os/exec/exec+linux.ha
@@ -173,6 +173,7 @@ fn platform_start(cmd: *command) (process | errors::error) = {
return errors::errno(err);
case let pid: int =>
rt::close(pipe[1])!;
+ defer rt::close(pipe[0])!;
let errno: int = 0;
match (rt::read(pipe[0], &errno, size(int))) {
case let err: rt::errno =>