From 9c93ff15e2f8c5930f6c3b30aec2e2e774142bd8 Mon Sep 17 00:00:00 2001 From: Karl Gustav Sterneberg <kg@roxen.com> Date: Wed, 11 Oct 2017 12:04:43 +0200 Subject: [PATCH] Fixed a null pointer exception. --- .../Filesystem.pmod/Monitor.pmod/basic.pike | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike b/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike index 8f9871429b..134c08559d 100644 --- a/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike +++ b/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike @@ -996,12 +996,15 @@ protected void inotify_event(int wd, int event, int cookie, string(8bit) path) // // Create the submonitor. MON_WARN("Monitor lost for path %O.\n", full_path); - monitor(full_path, m->flags | MF_AUTO | MF_HARD, - m->max_dir_check_interval, - m->file_interval_factor, - m->stable_time); - m = monitors[full_path]; - m->check(0); // Init monitor. + m = monitor(full_path, m->flags | MF_AUTO | MF_HARD, + m->max_dir_check_interval, + m->file_interval_factor, + m->stable_time); + // monitor() will not register monitor for path if filter_file() + // returns 0. + if (m) { + m->check(0); // Init monitor. + } } } } @@ -1325,7 +1328,7 @@ protected DefaultMonitor monitor_factory(string path, MonitorFlags|void flags, //! //! @seealso //! @[release()] -void monitor(string path, MonitorFlags|void flags, +Monitor|void monitor(string path, MonitorFlags|void flags, int(0..)|void max_dir_check_interval, int(0..)|void file_interval_factor, int(0..)|void stable_time) @@ -1356,6 +1359,7 @@ void monitor(string path, MonitorFlags|void flags, // NB: Registering with the monitor_queue is done as // needed by register_path() as called by create(). } + return m; } int filter_file(string path) -- GitLab