Changeset

5252:6209b9a0244b

mod_http_files: No use in closing a file handle if we couldn't open it
author Kim Alvefur <zash@zash.se>
date Fri, 21 Dec 2012 08:10:07 +0100
parents 5250:6d8ec8c90240
children 5253:ad45612199e0
files plugins/mod_http_files.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_http_files.lua	Sun Dec 16 14:36:24 2012 +0100
+++ b/plugins/mod_http_files.lua	Fri Dec 21 08:10:07 2012 +0100
@@ -106,9 +106,11 @@
 		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