diff mod_firewall/definitions.lib.lua @ 4017:015452258952

mod_firewall: Ensure file lists are always initialized empty
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 May 2020 12:31:51 +0100
parents b872f111b7af
children e9e10ec1b91c
line wrap: on
line diff
--- a/mod_firewall/definitions.lib.lua	Mon May 11 17:18:30 2020 +0100
+++ b/mod_firewall/definitions.lib.lua	Tue May 12 12:31:51 2020 +0100
@@ -148,8 +148,8 @@
 	-- %LIST: file:/path/to/file
 	file = {
 		init = function (self, file_spec, opts)
-			local items = {};
-			local n = 0;
+			local n, items = 0, {};
+			self.items = items;
 			local filename = file_spec:gsub("^file:", "");
 			if opts.missing == "ignore" and not lfs.attributes(filename, "mode") then
 				module:log("debug", "Ignoring missing list file: %s", filename);
@@ -167,7 +167,6 @@
 					end
 				end
 			end
-			self.items = items;
 			module:log("debug", "Loaded %d items from %s", n, filename);
 		end;
 		add = function (self, item)