mirror of https://github.com/fail2ban/fail2ban
pyinotify: amend to 1e4a14fb25d88e32f3ca9c06fb1d6b8d3b4813ab: one fix more for sporadic runtime error "dictionary changed size during iteration" (watched files)
parent
e323c148e1
commit
ba282b794c
|
@ -188,7 +188,7 @@ class FilterPyinotify(FileFilter):
|
||||||
self._refreshWatcher(path, isDir=isDir)
|
self._refreshWatcher(path, isDir=isDir)
|
||||||
if isDir:
|
if isDir:
|
||||||
# check all files belong to this dir:
|
# check all files belong to this dir:
|
||||||
for logpath in self.__watchFiles:
|
for logpath in list(self.__watchFiles):
|
||||||
if logpath.startswith(path + pathsep):
|
if logpath.startswith(path + pathsep):
|
||||||
# if still no file - add to pending, otherwise refresh and process:
|
# if still no file - add to pending, otherwise refresh and process:
|
||||||
if not os.path.isfile(logpath):
|
if not os.path.isfile(logpath):
|
||||||
|
@ -285,7 +285,7 @@ class FilterPyinotify(FileFilter):
|
||||||
logSys.error("Failed to remove watch on path: %s", path)
|
logSys.error("Failed to remove watch on path: %s", path)
|
||||||
|
|
||||||
path_dir = dirname(path)
|
path_dir = dirname(path)
|
||||||
for k in self.__watchFiles:
|
for k in list(self.__watchFiles):
|
||||||
if k.startswith(path_dir + pathsep):
|
if k.startswith(path_dir + pathsep):
|
||||||
path_dir = None
|
path_dir = None
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue