1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-02 12:59:02 +00:00

Make os calls local in nse_main.lua

This commit is contained in:
dmiller
2017-03-21 16:20:40 +00:00
parent 36702702e5
commit 48641e3a14

View File

@@ -129,6 +129,10 @@ local remove = table.remove;
local sort = table.sort;
local unpack = table.unpack;
local os = require "os"
local time = os.time
local difftime = os.difftime
do -- Add loader to look in nselib/?.lua (nselib/ can be in multiple places)
local function loader (lib)
lib = lib:gsub("%.", "/"); -- change Lua "module separator" to directory separator
@@ -389,7 +393,7 @@ do
-- checking whether user gave --script-timeout option or not
if cnse.script_timeout and cnse.script_timeout > 0 then
-- comparing script's timeout with time elapsed
script_timeout = cnse.script_timeout < os.difftime(os.time(), self.start_time)
script_timeout = cnse.script_timeout < difftime(time(), self.start_time)
end
if self.type == "hostrule" or self.type == "portrule" then
host_timeout = cnse.timedOut(self.host);
@@ -419,7 +423,7 @@ do
if self.worker then
self.start_time = self.parent.start_time
else
self.start_time = os.time()
self.start_time = time()
end
end