mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath: Add the Stream record to Log:active_streams to make more dynamic logging possible. Fix portability of printing to files returned by open("/dev/stderr"). Fix mime type diff canonifier to also skip mime_desc columns Unit test tweaks/fixes. Fix memory leak of serialized IDs when compiled with --enable-debug. One tweak to the open() change: make sure we don't try to rotate the special files.
This commit is contained in:
commit
0f663ca813
23 changed files with 211 additions and 70 deletions
25
src/File.cc
25
src/File.cc
|
@ -138,11 +138,22 @@ BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
|
|||
BroFile::BroFile(const char* arg_name, const char* arg_access, BroType* arg_t)
|
||||
{
|
||||
Init();
|
||||
|
||||
f = 0;
|
||||
name = copy_string(arg_name);
|
||||
access = copy_string(arg_access);
|
||||
t = arg_t ? arg_t : base_type(TYPE_STRING);
|
||||
if ( ! Open() )
|
||||
|
||||
if ( streq(name, "/dev/stdin") )
|
||||
f = stdin;
|
||||
else if ( streq(name, "/dev/stdout") )
|
||||
f = stdout;
|
||||
else if ( streq(name, "/dev/stderr") )
|
||||
f = stderr;
|
||||
|
||||
if ( f )
|
||||
is_open = 1;
|
||||
|
||||
else if ( ! Open() )
|
||||
{
|
||||
reporter->Error("cannot open %s: %s", name, strerror(errno));
|
||||
is_open = 0;
|
||||
|
@ -342,8 +353,8 @@ int BroFile::Close()
|
|||
|
||||
FinishEncrypt();
|
||||
|
||||
// Do not close stdout/stderr.
|
||||
if ( f == stdout || f == stderr )
|
||||
// Do not close stdin/stdout/stderr.
|
||||
if ( f == stdin || f == stdout || f == stderr )
|
||||
return 0;
|
||||
|
||||
if ( is_in_cache )
|
||||
|
@ -508,7 +519,7 @@ void BroFile::SetAttrs(Attributes* arg_attrs)
|
|||
|
||||
if ( attrs->FindAttr(ATTR_RAW_OUTPUT) )
|
||||
EnableRawOutput();
|
||||
|
||||
|
||||
InstallRotateTimer();
|
||||
}
|
||||
|
||||
|
@ -523,6 +534,10 @@ RecordVal* BroFile::Rotate()
|
|||
if ( ! is_open )
|
||||
return 0;
|
||||
|
||||
// Do not rotate stdin/stdout/stderr.
|
||||
if ( f == stdin || f == stdout || f == stderr )
|
||||
return 0;
|
||||
|
||||
if ( okay_to_manage && ! is_in_cache )
|
||||
BringIntoCache();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue