mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-01 17:12:21 +00:00
Use distinct names for file and program output pointers. (#335)
sysdig-CLA-1.0-signed-off-by: Josh Carp <jm.carp@gmail.com>
This commit is contained in:
parent
88327abb41
commit
a0053dba18
@ -46,30 +46,30 @@ end
|
|||||||
|
|
||||||
function mod.file(priority, priority_num, buffered, msg, options)
|
function mod.file(priority, priority_num, buffered, msg, options)
|
||||||
if options.keep_alive == "true" then
|
if options.keep_alive == "true" then
|
||||||
if file == nil then
|
if ffile == nil then
|
||||||
file = io.open(options.filename, "a+")
|
ffile = io.open(options.filename, "a+")
|
||||||
if buffered == 0 then
|
if buffered == 0 then
|
||||||
file:setvbuf 'no'
|
ffile:setvbuf 'no'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
file = io.open(options.filename, "a+")
|
ffile = io.open(options.filename, "a+")
|
||||||
end
|
end
|
||||||
|
|
||||||
file:write(msg, "\n")
|
ffile:write(msg, "\n")
|
||||||
|
|
||||||
if options.keep_alive == nil or
|
if options.keep_alive == nil or
|
||||||
options.keep_alive ~= "true" then
|
options.keep_alive ~= "true" then
|
||||||
file:close()
|
ffile:close()
|
||||||
file = nil
|
ffile = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function mod.file_cleanup()
|
function mod.file_cleanup()
|
||||||
if file ~= nil then
|
if ffile ~= nil then
|
||||||
file:flush()
|
ffile:flush()
|
||||||
file:close()
|
ffile:close()
|
||||||
file = nil
|
ffile = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -87,30 +87,30 @@ function mod.program(priority, priority_num, buffered, msg, options)
|
|||||||
|
|
||||||
-- Note: options are all strings
|
-- Note: options are all strings
|
||||||
if options.keep_alive == "true" then
|
if options.keep_alive == "true" then
|
||||||
if file == nil then
|
if pfile == nil then
|
||||||
file = io.popen(options.program, "w")
|
pfile = io.popen(options.program, "w")
|
||||||
if buffered == 0 then
|
if buffered == 0 then
|
||||||
file:setvbuf 'no'
|
pfile:setvbuf 'no'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
file = io.popen(options.program, "w")
|
pfile = io.popen(options.program, "w")
|
||||||
end
|
end
|
||||||
|
|
||||||
file:write(msg, "\n")
|
pfile:write(msg, "\n")
|
||||||
|
|
||||||
if options.keep_alive == nil or
|
if options.keep_alive == nil or
|
||||||
options.keep_alive ~= "true" then
|
options.keep_alive ~= "true" then
|
||||||
file:close()
|
pfile:close()
|
||||||
file = nil
|
pfile = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function mod.program_cleanup()
|
function mod.program_cleanup()
|
||||||
if file ~= nil then
|
if pfile ~= nil then
|
||||||
file:flush()
|
pfile:flush()
|
||||||
file:close()
|
pfile:close()
|
||||||
file = nil
|
pfile = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user