summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-10-17 16:14:02 +0200
committerAnton Kling <anton@kling.gg>2024-10-17 16:14:02 +0200
commit43e0b9dd92eaf56ed58959e696b3f53100a0da69 (patch)
tree0d677c68bcefcc9786835dedb05915aea1ce4b5e
parent4e817cecfa7328af34fb96db7f052352737cd07e (diff)
httpd: Bug fix close unused file descriptor
-rw-r--r--userland/httpd/httpd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/userland/httpd/httpd.c b/userland/httpd/httpd.c
index e65dcf8..9593caf 100644
--- a/userland/httpd/httpd.c
+++ b/userland/httpd/httpd.c
@@ -98,6 +98,9 @@ void request_try_file(struct http_request *request, const char *path) {
request->status_code = 404;
return;
}
+ if (-1 != request->file_fd) {
+ close(request->file_fd);
+ }
request->file_fd = fd;
struct stat statbuf;
if (-1 == fstat(request->file_fd, &statbuf)) {