summaryrefslogtreecommitdiff
path: root/ev.c
diff options
context:
space:
mode:
Diffstat (limited to 'ev.c')
-rw-r--r--ev.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/ev.c b/ev.c
index 5071b4a..aa38d1d 100644
--- a/ev.c
+++ b/ev.c
@@ -3103,25 +3103,28 @@ stat_timer_cb (EV_P_ ev_timer *w_, int revents)
{
ev_stat *w = (ev_stat *)(((char *)w_) - offsetof (ev_stat, timer));
- /* we copy this here each the time so that */
- /* prev has the old value when the callback gets invoked */
- w->prev = w->attr;
+ ev_statdata prev = w->attr;
ev_stat_stat (EV_A_ w);
/* memcmp doesn't work on netbsd, they.... do stuff to their struct stat */
if (
- w->prev.st_dev != w->attr.st_dev
- || w->prev.st_ino != w->attr.st_ino
- || w->prev.st_mode != w->attr.st_mode
- || w->prev.st_nlink != w->attr.st_nlink
- || w->prev.st_uid != w->attr.st_uid
- || w->prev.st_gid != w->attr.st_gid
- || w->prev.st_rdev != w->attr.st_rdev
- || w->prev.st_size != w->attr.st_size
- || w->prev.st_atime != w->attr.st_atime
- || w->prev.st_mtime != w->attr.st_mtime
- || w->prev.st_ctime != w->attr.st_ctime
+ prev.st_dev != w->attr.st_dev
+ || prev.st_ino != w->attr.st_ino
+ || prev.st_mode != w->attr.st_mode
+ || prev.st_nlink != w->attr.st_nlink
+ || prev.st_uid != w->attr.st_uid
+ || prev.st_gid != w->attr.st_gid
+ || prev.st_rdev != w->attr.st_rdev
+ || prev.st_size != w->attr.st_size
+ || prev.st_atime != w->attr.st_atime
+ || prev.st_mtime != w->attr.st_mtime
+ || prev.st_ctime != w->attr.st_ctime
) {
+ /* we only update w->prev on actual differences */
+ /* in case we test more often than invoke the callback, */
+ /* to ensure that prev is always different to attr */
+ w->prev = prev;
+
#if EV_USE_INOTIFY
if (fs_fd >= 0)
{