From fe4465124d1d9486910440641e1df287a0d3f56f Mon Sep 17 00:00:00 2001
From: Ian Moffett <ian@osmora.org>
Date: Fri, 26 Apr 2024 22:47:05 -0400
Subject: kernel: kern_exec: Close file descriptor

Signed-off-by: Ian Moffett <ian@osmora.org>
---
 sys/kern/kern_exec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index b5b4cd2..1c91025 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -205,6 +205,7 @@ execv(char *pathname, char **argv, uintptr_t *sp_res)
     set_frame_ip(td->tf, args.auxv.at_entry);
 done:
     /* We are done, free argp and release the thread */
+    fd_close_fdnum(td, fd);
     spinlock_release(&td->lock);
     dynfree(args.argp);
     return ret;
-- 
cgit v1.2.3