From e104ed8cac86435d879cdbd21cb45c01bb026782 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 21 Dec 2012 08:10:07 +0100 Subject: mod_http_files: No use in closing a file handle if we couldn't open it --- plugins/mod_http_files.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua index d83e6f97..92c49e11 100644 --- a/plugins/mod_http_files.lua +++ b/plugins/mod_http_files.lua @@ -106,9 +106,11 @@ function serve_file(event, path) end else - local f = open(full_path, "rb"); - data = f and f:read("*a"); - f:close(); + local f, err = open(full_path, "rb"); + if f then + data = f:read("*a"); + f:close(); + end if not data then return 403; end -- cgit v1.2.3