Skip to content
Snippets Groups Projects
Commit 7e366857 authored by Tomas Krizek's avatar Tomas Krizek
Browse files

Merge branch 'fix-docker-outdir' into 'master'

shotgun: improve default dir handling when $PWD var is not set

See merge request !18
parents 8e6edb79 e8c44e84
No related branches found
No related tags found
1 merge request!18shotgun: improve default dir handling when $PWD var is not set
Pipeline #68880 passed
......@@ -18,6 +18,7 @@ local function isdir(path)
return exists(path.."/")
end
local dir = os.getenv("PWD") or ""
local object = require("dnsjit.core.objects")
local log = require("dnsjit.core.log")
local getopt = require("dnsjit.lib.getopt").new({
......@@ -34,7 +35,7 @@ local getopt = require("dnsjit.lib.getopt").new({
{ nil, "bind-pattern", "", "Source IPv6 bind address pattern (example: 'fd00::%x')", "?" },
{ nil, "bind-num", 1, "Number of source IPs per thread (when --bind-pattern is set)", "?" },
{ nil, "drift", 1, "Maximum realtime drift (seconds)", "?" },
{ "O", "outdir", os.getenv("PWD"), "Directory for output files (must exist)", "?" },
{ "O", "outdir", dir, "Directory for output files (must exist)", "?" },
})
local pcap = unpack(getopt:parse())
if getopt:val("help") then
......@@ -98,7 +99,7 @@ if string.find(TLS_PRIORITY, '"') ~= nil or string.find(TLS_PRIORITY, "'") ~= ni
log.fatal("tls priority string may not contain quotes");
end
local OUTDIR = getopt:val("O")
if not isdir(OUTDIR) then
if OUTDIR == "" or not isdir(OUTDIR) then
log.fatal("output directory \"" .. OUTDIR .. "\" doesn't exist")
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment