… | |
… | |
2478 | int mask = IN_MASK_ADD | IN_DELETE_SELF | IN_MOVE_SELF |
2478 | int mask = IN_MASK_ADD | IN_DELETE_SELF | IN_MOVE_SELF |
2479 | | (errno == EACCES ? IN_ATTRIB : IN_CREATE | IN_MOVED_TO); |
2479 | | (errno == EACCES ? IN_ATTRIB : IN_CREATE | IN_MOVED_TO); |
2480 | |
2480 | |
2481 | char *pend = strrchr (path, '/'); |
2481 | char *pend = strrchr (path, '/'); |
2482 | |
2482 | |
2483 | if (!pend) |
2483 | if (!pend || pend == path) |
2484 | break; /* whoops, no '/', complain to your admin */ |
2484 | break; |
2485 | |
2485 | |
2486 | *pend = 0; |
2486 | *pend = 0; |
2487 | w->wd = inotify_add_watch (fs_fd, path, mask); |
2487 | w->wd = inotify_add_watch (fs_fd, path, mask); |
2488 | } |
2488 | } |
2489 | while (w->wd < 0 && (errno == ENOENT || errno == EACCES)); |
2489 | while (w->wd < 0 && (errno == ENOENT || errno == EACCES)); |
2490 | } |
2490 | } |
2491 | } |
2491 | } |
2492 | else |
2492 | |
|
|
2493 | if (w->wd >= 0) |
2493 | { |
2494 | { |
2494 | wlist_add (&fs_hash [w->wd & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w); |
2495 | wlist_add (&fs_hash [w->wd & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w); |
2495 | |
2496 | |
2496 | /* now local changes will be tracked by inotify, but remote changes won't */ |
2497 | /* now local changes will be tracked by inotify, but remote changes won't */ |
2497 | /* unless the filesystem it known to be local, we therefore still poll */ |
2498 | /* unless the filesystem it known to be local, we therefore still poll */ |
… | |
… | |
2547 | |
2548 | |
2548 | if (w->wd == wd || wd == -1) |
2549 | if (w->wd == wd || wd == -1) |
2549 | { |
2550 | { |
2550 | if (ev->mask & (IN_IGNORED | IN_UNMOUNT | IN_DELETE_SELF)) |
2551 | if (ev->mask & (IN_IGNORED | IN_UNMOUNT | IN_DELETE_SELF)) |
2551 | { |
2552 | { |
|
|
2553 | wlist_del (&fs_hash [slot & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w); |
2552 | w->wd = -1; |
2554 | w->wd = -1; |
2553 | infy_add (EV_A_ w); /* re-add, no matter what */ |
2555 | infy_add (EV_A_ w); /* re-add, no matter what */ |
2554 | } |
2556 | } |
2555 | |
2557 | |
2556 | stat_timer_cb (EV_A_ &w->timer, 0); |
2558 | stat_timer_cb (EV_A_ &w->timer, 0); |