mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Fix crash on using some deprecated environment variables
If the global Reporter hasn't been created before trying to use a deprecated environment variable, emit the warning to stderr directly instead of via Reporter. Fixes GH-989
This commit is contained in:
parent
138c9402c3
commit
1c08be1c0f
1 changed files with 6 additions and 1 deletions
|
@ -2365,7 +2365,12 @@ char* zeekenv(const char* name)
|
||||||
auto val = getenv(it->second);
|
auto val = getenv(it->second);
|
||||||
|
|
||||||
if ( val && starts_with(it->second, "BRO_") )
|
if ( val && starts_with(it->second, "BRO_") )
|
||||||
reporter->Warning("Using legacy environment variable %s, support will be removed in Zeek v4.1; use %s instead", it->second, name);
|
{
|
||||||
|
if ( reporter )
|
||||||
|
reporter->Warning("Using legacy environment variable %s, support will be removed in Zeek v4.1; use %s instead", it->second, name);
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Using legacy environment variable %s, support will be removed in Zeek v4.1; use %s instead\n", it->second, name);
|
||||||
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue