*/
static void inotify_dispatch(struct inotify_private *in,
struct inotify_event *e,
+ int prev_wd,
uint32_t prev_cookie,
struct inotify_event *e2)
{
} else if (e->mask & IN_DELETE) {
ne.action = NOTIFY_ACTION_REMOVED;
} else if (e->mask & IN_MOVED_FROM) {
- if (e2 != NULL && e2->cookie == e->cookie) {
+ if (e2 != NULL && e2->cookie == e->cookie &&
+ e2->wd == e->wd) {
ne.action = NOTIFY_ACTION_OLD_NAME;
} else {
ne.action = NOTIFY_ACTION_REMOVED;
}
} else if (e->mask & IN_MOVED_TO) {
- if (e->cookie == prev_cookie) {
+ if ((e->cookie == prev_cookie) && (e->wd == prev_wd)) {
ne.action = NOTIFY_ACTION_NEW_NAME;
} else {
ne.action = NOTIFY_ACTION_ADDED;
int bufsize = 0;
struct inotify_event *e0, *e;
uint32_t prev_cookie=0;
+ int prev_wd = -1;
NTSTATUS status;
/*
if (e == NULL) return;
((uint8_t *)e)[bufsize] = '\0';
- status = read_data(in->fd, (char *)e0, bufsize);
+ status = read_data_ntstatus(in->fd, (char *)e0, bufsize);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to read all inotify data - %s\n",
nt_errstr(status)));
if (bufsize >= sizeof(*e)) {
e2 = (struct inotify_event *)(e->len + sizeof(*e) + (char *)e);
}
- inotify_dispatch(in, e, prev_cookie, e2);
+ inotify_dispatch(in, e, prev_wd, prev_cookie, e2);
+ prev_wd = e->wd;
prev_cookie = e->cookie;
e = e2;
}