mod_http_files: No use in closing a file handle if we couldn't open it
authorKim Alvefur <zash@zash.se>
Fri, 21 Dec 2012 08:10:07 +0100
changeset 5252 6209b9a0244b
parent 5250 6d8ec8c90240
child 5253 ad45612199e0
mod_http_files: No use in closing a file handle if we couldn't open it
plugins/mod_http_files.lua
--- 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