mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Update to make Dir::monitor watch inodes instead of file names.
This commit is contained in:
parent
035b668f73
commit
08348b2bc2
1 changed files with 6 additions and 5 deletions
|
@ -23,11 +23,11 @@ export {
|
||||||
|
|
||||||
event Dir::monitor_ev(dir: string, last_files: set[string], callback: function(fname: string))
|
event Dir::monitor_ev(dir: string, last_files: set[string], callback: function(fname: string))
|
||||||
{
|
{
|
||||||
when ( local result = Exec::run([$cmd=fmt("ls \"%s\"", str_shell_escape(dir))]) )
|
when ( local result = Exec::run([$cmd=fmt("ls -i \"%s/\"", str_shell_escape(dir))]) )
|
||||||
{
|
{
|
||||||
if ( result$exit_code != 0 )
|
if ( result$exit_code != 0 )
|
||||||
{
|
{
|
||||||
Reporter::warning("Requested monitoring of non-existent directory.");
|
Reporter::warning(fmt("Requested monitoring of non-existent directory (%s).", dir));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,9 +35,10 @@ event Dir::monitor_ev(dir: string, last_files: set[string], callback: function(f
|
||||||
local files = result$stdout;
|
local files = result$stdout;
|
||||||
for ( i in files )
|
for ( i in files )
|
||||||
{
|
{
|
||||||
if ( files[i] !in last_files )
|
local parts = split1(files[i], / /);
|
||||||
callback(build_path_compressed(dir, files[i]));
|
if ( parts[1] !in last_files )
|
||||||
add current_files[files[i]];
|
callback(build_path_compressed(dir, parts[2]));
|
||||||
|
add current_files[parts[1]];
|
||||||
}
|
}
|
||||||
schedule polling_interval { Dir::monitor_ev(dir, current_files, callback) };
|
schedule polling_interval { Dir::monitor_ev(dir, current_files, callback) };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue