aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-30 17:51:45 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-30 17:51:45 +0100
commit6b7c9efcb81b67b5293428813badd2c57416a75f (patch)
tree91cf5ef2aa4da437ce1832b76e9f08c76e2aa5da
parent0659beb4eb6a475e488bcb01c7a2488ff34c0b7b (diff)
downloadrspamd-6b7c9efcb81b67b5293428813badd2c57416a75f.tar.gz
rspamd-6b7c9efcb81b67b5293428813badd2c57416a75f.zip
[Minor] Fix work with file names
-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