From: Vsevolod Stakhov Date: Fri, 30 Apr 2021 16:51:45 +0000 (+0100) Subject: [Minor] Fix work with file names X-Git-Tag: 3.0~445 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b7c9efcb81b67b5293428813badd2c57416a75f;p=thirdparty%2Frspamd.git [Minor] Fix work with file names --- diff --git a/lualib/rspamadm/statistics_dump.lua b/lualib/rspamadm/statistics_dump.lua index bbd4e24105..ab4e026c52 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