Fix infinite add_watches loop with symbolic links

Added a check to ensure that add_watches doesn't run on the same folder over and over again. This occurs at least when circular symbolic links are present.

Fix #543
This commit is contained in:
michaelbeaumont 2013-06-12 11:09:50 +02:00
parent 2758c349db
commit 8de2a9abf9

View File

@ -50,6 +50,10 @@ class INotifyTreeWatcher(INotify):
''' Add watches for this directory and all its descendant directories,
recursively. '''
base = realpath(base)
# There may exist a link which leads to an endless
# add_watches loop or to maximum recursion depth exceeded
if not top_level and base in self.watched_dirs:
return
try:
is_dir = self.add_watch(base)
except OSError as e: