summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Martini <seb@dbzteam.org>2012-03-11 21:41:04 +0100
committerSebastien Martini <seb@dbzteam.org>2012-03-11 21:41:04 +0100
commitf3f89a6266186433b4869e603153396829ce6671 (patch)
tree8679fb61d1bc89517121bc8d5d96088955ee3e75
parent98c5f41a6e2e90827a63ff1b878596f4080481cc (diff)
downloadpyinotify-f3f89a6266186433b4869e603153396829ce6671.tar.gz
auto_add=True automatically implies oring IN_CREATE with the
provided mask value. Misbehavior reported by Maxime Augier https://github.com/maugier.
-rwxr-xr-xpython2/pyinotify.py9
-rwxr-xr-xpython3/pyinotify.py9
2 files changed, 14 insertions, 4 deletions
diff --git a/python2/pyinotify.py b/python2/pyinotify.py
index 9dac7c7..74d56db 100755
--- a/python2/pyinotify.py
+++ b/python2/pyinotify.py
@@ -1761,6 +1761,8 @@ class WatchManager:
watch manager dictionary. Return the wd value.
"""
path = self.__format_path(path)
+ if auto_add and not mask & IN_CREATE:
+ mask |= IN_CREATE
wd = self._inotify_wrapper.inotify_add_watch(self._fd, path, mask)
if wd < 0:
return wd
@@ -1805,6 +1807,8 @@ class WatchManager:
@type rec: bool
@param auto_add: Automatically add watches on newly created
directories in watched parent |path| directory.
+ If |auto_add| is True, IN_CREATE is ored with |mask|
+ when the watch is added.
@type auto_add: bool
@param do_glob: Do globbing on pathname (see standard globbing
module for more informations).
@@ -1914,8 +1918,9 @@ class WatchManager:
subdirectories contained into |wd| directory.
@type rec: bool
@param auto_add: Automatically adds watches on newly created
- directories in the watch's path corresponding to
- |wd|.
+ directories in the watch's path corresponding to |wd|.
+ If |auto_add| is True, IN_CREATE is ored with |mask|
+ when the watch is updated.
@type auto_add: bool
@param quiet: If False raises a WatchManagerError exception on
error. See example not_quiet.py
diff --git a/python3/pyinotify.py b/python3/pyinotify.py
index 5194255..91cf532 100755
--- a/python3/pyinotify.py
+++ b/python3/pyinotify.py
@@ -1746,6 +1746,8 @@ class WatchManager:
watch manager dictionary. Return the wd value.
"""
path = self.__format_path(path)
+ if auto_add and not mask & IN_CREATE:
+ mask |= IN_CREATE
wd = self._inotify_wrapper.inotify_add_watch(self._fd, path, mask)
if wd < 0:
return wd
@@ -1788,6 +1790,8 @@ class WatchManager:
@type rec: bool
@param auto_add: Automatically add watches on newly created
directories in watched parent |path| directory.
+ If |auto_add| is True, IN_CREATE is ored with |mask|
+ when the watch is added.
@type auto_add: bool
@param do_glob: Do globbing on pathname (see standard globbing
module for more informations).
@@ -1901,8 +1905,9 @@ class WatchManager:
subdirectories contained into |wd| directory.
@type rec: bool
@param auto_add: Automatically adds watches on newly created
- directories in the watch's path corresponding to
- |wd|.
+ directories in the watch's path corresponding to |wd|.
+ If |auto_add| is True, IN_CREATE is ored with |mask|
+ when the watch is updated.
@type auto_add: bool
@param quiet: If False raises a WatchManagerError exception on
error. See example not_quiet.py