- if (s->type == PATH_CHANGED && s->primary_wd == buf->wd)
- path_enter_running(p);
- else
- path_enter_waiting(p, false);
+ while (k > 0) {
+ size_t step;
+
+ if (s->type == PATH_CHANGED && s->primary_wd == e->wd)
+ path_enter_running(p);
+ else
+ path_enter_waiting(p, false);
+
+ step = sizeof(struct inotify_event) + e->len;
+ assert(step <= (size_t) k);
+
+ e = (struct inotify_event*) ((uint8_t*) e + step);
+ k -= step;
+ }