aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm/statistics_dump.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lualib/rspamadm/statistics_dump.lua')
-rw-r--r--lualib/rspamadm/statistics_dump.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/lualib/rspamadm/statistics_dump.lua b/lualib/rspamadm/statistics_dump.lua
index bbd4e2410..ab4e026c5 100644
--- a/lualib/rspamadm/statistics_dump.lua
+++ b/lualib/rspamadm/statistics_dump.lua
@@ -378,7 +378,7 @@ local function execute_batch(batch, conns, opts)
end
local function restore_handler(opts)
- local files = opts.files or {'-'}
+ local files = opts.file or {'-'}
local conns = {}
for _,cls in ipairs(classifiers) do
@@ -395,8 +395,10 @@ local function restore_handler(opts)
local batch = {}
for _,f in ipairs(files) do
+ local fd
if f ~= '-' then
- io.input(f)
+ fd = io.open(f, 'r')
+ io.input(fd)
end
local cur_line = 1
@@ -418,6 +420,8 @@ local function restore_handler(opts)
batch = {}
end
end
+
+ if fd then fd:close() end
end
if #batch > 0 then