diff --git a/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike b/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike index f129fac1999fb5d4d102cfad8a30c1a1eeb2ac3d..ac6c6a8b61d6df1c4e4887a8bdcb27c5314d8408 100644 --- a/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike +++ b/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike @@ -979,6 +979,7 @@ protected class InotifyMonitor } Stdio.Stat st = file_stat (path, 1); + mixed err; if (st && st->isdir) { // Note: We only want to add watchers on directories. File // notifications will take place on the directory watch @@ -986,7 +987,7 @@ protected class InotifyMonitor // on individual files is handled in the inotify_event // callback. - if (mixed err = catch { + if (err = catch { int new_wd = instance->add_watch(path, System.Inotify.IN_MOVED_FROM | System.Inotify.IN_UNMOUNT | @@ -1021,7 +1022,9 @@ protected class InotifyMonitor } } - return; + if (st && !err) + return; // Return early if setup was successful, i.e. avoid + // registering a polling monitor. #endif /* !INHIBIT_INOTIFY_MONITOR */ MON_WERR("Registering %O for polling.\n", path);