summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2008-12-12 20:35:21 +0000
committerroot <root>2008-12-12 20:35:21 +0000
commit596d7d3713224fd2bb1dca6f02288a7b2bbc1f2c (patch)
treec950b2bdf0c68c35291965615163f6baa4382786
parent73dc4a3e604cf3ffb01ff3436669a29b062e3585 (diff)
infy fix
-rw-r--r--Changes3
-rw-r--r--ev.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/Changes b/Changes
index 7f4e6fd..c8cbd5c 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
Revision history for libev, a high-performance and full-featured event loop.
+ - fix a bug where an inotify watcher was added twice, causing
+ freezes on hash collisions.
- new config symbol, EV_USE_CLOCK_SYSCALL, to make libev use
a direct syscall - slower, but no dependency on librt et al.
- assume negative return values != -1 signals success of port_getn
@@ -10,6 +12,7 @@ Revision history for libev, a high-performance and full-featured event loop.
- fixed const object callbacks in ev++.h.
- replaced loop_ref argument of watcher.set (loop) by a direct
ev_loop * in ev++.h, to avoid clashes with functor patch.
+ - do not try to watch the empty string via inotify.
3.49 Wed Nov 19 11:26:53 CET 2008
- ev_stat watchers will now use inotify as a mere hint on
diff --git a/ev.c b/ev.c
index 538f6a5..199148a 100644
--- a/ev.c
+++ b/ev.c
@@ -2480,8 +2480,8 @@ infy_add (EV_P_ ev_stat *w)
char *pend = strrchr (path, '/');
- if (!pend)
- break; /* whoops, no '/', complain to your admin */
+ if (!pend || pend == path)
+ break;
*pend = 0;
w->wd = inotify_add_watch (fs_fd, path, mask);
@@ -2489,7 +2489,8 @@ infy_add (EV_P_ ev_stat *w)
while (w->wd < 0 && (errno == ENOENT || errno == EACCES));
}
}
- else
+
+ if (w->wd >= 0)
{
wlist_add (&fs_hash [w->wd & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w);
@@ -2549,6 +2550,7 @@ infy_wd (EV_P_ int slot, int wd, struct inotify_event *ev)
{
if (ev->mask & (IN_IGNORED | IN_UNMOUNT | IN_DELETE_SELF))
{
+ wlist_del (&fs_hash [slot & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w);
w->wd = -1;
infy_add (EV_A_ w); /* re-add, no matter what */
}