[PATCH] inotify: Setting up a non-NULL return value to _inotify.remove_watch

Nicolas Dumazet nicdumz at gmail.com
Thu Mar 26 02:31:02 CDT 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1238052263 -32400
# Node ID fed7e487c58ba7f874f0e468ee31790ab3180904
# Parent  c2ecaf63badee4e973c4d843121139d4d3269f12
inotify: Setting up a non-NULL return value to _inotify.remove_watch

Prior to this, any call to that function would raise an exception.
The call to linux.watcher.remove had apparently been replaced by a call to
linux.watcher._remove to avoid that exception. The consequence was that
files registered to inotify service were never unregistered (!)

diff -r c2ecaf63bade -r fed7e487c58b hgext/inotify/linux/_inotify.c
--- a/hgext/inotify/linux/_inotify.c	Sun Mar 22 20:59:03 2009 +0100
+++ b/hgext/inotify/linux/_inotify.c	Thu Mar 26 16:24:23 2009 +0900
@@ -125,6 +125,8 @@
 
     Py_INCREF(Py_None);
 
+    ret = Py_None;
+
     goto done;
 
 bail:
diff -r c2ecaf63bade -r fed7e487c58b hgext/inotify/linux/watcher.py
--- a/hgext/inotify/linux/watcher.py	Sun Mar 22 20:59:03 2009 +0100
+++ b/hgext/inotify/linux/watcher.py	Thu Mar 26 16:24:23 2009 +0900
@@ -179,7 +179,7 @@
         for evt in inotify.read(self.fd, bufsize):
             events.append(Event(evt, self._wds[evt.wd][0]))
             if evt.mask & inotify.IN_IGNORED:
-                self._remove(evt.wd)
+                self.remove(evt.wd)
             elif evt.mask & inotify.IN_UNMOUNT:
                 self.close()
         return events


More information about the Mercurial-devel mailing list