From 43e0b9dd92eaf56ed58959e696b3f53100a0da69 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 17 Oct 2024 16:14:02 +0200 Subject: httpd: Bug fix close unused file descriptor --- userland/httpd/httpd.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'userland/httpd') 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)) { -- cgit v1.2.3