1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00

Fix io.close calls in whois-ip

This commit is contained in:
dmiller
2020-02-04 18:57:02 +00:00
parent 8515e83671
commit d341c45cf4

View File

@@ -1910,12 +1910,12 @@ function file_stat( path )
local f, err = io.open(path, 'r') local f, err = io.open(path, 'r')
if f then if f then
f.close() f:close()
exists = true exists = true
readable = true readable = true
f, err = io.open(path, 'a') f, err = io.open(path, 'a')
if f then if f then
f.close() f:close()
writable = true writable = true
elseif err:match('Permission denied') then elseif err:match('Permission denied') then
writable = false writable = false
@@ -1924,11 +1924,11 @@ function file_stat( path )
exists = false exists = false
f, err = io.open(path, 'w') f, err = io.open(path, 'w')
if f then if f then
f.close() f:close()
writable = true writable = true
f, err = io.open(path, 'r') f, err = io.open(path, 'r')
if f then if f then
f.close() f:close()
readable = true readable = true
elseif err:match('Permission denied') then elseif err:match('Permission denied') then
readable = false readable = false