erikzenker / inotify-cpp

A C++ interface for linux inotify
MIT License
136 stars 37 forks source link

Register handler with individual event for combined flags #91

Open hrkn opened 1 year ago

hrkn commented 1 year ago

This PR fixes events from combined flags (i.e. Event::move and Event::close) are handled as unexpected event by misregistrating event handler function.

Steps to reproduce issue

  1. Build example (no modification needed)
  2. Run example with arbitrary directory (ex. /tmp)
  3. Run touch /tmp/a
  4. Run mv /tmp/a /tmp/aa
  5. Now you may see message like below which says events are not expected
    Event moved_from  on "/tmp/a" at 4072388246712760 was triggered, but was not expected
    Event moved_to  on "/tmp/aa" at 4072388246784505 was triggered, but was not expected