Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inotify can raise some errors if init is too fast #10

Open
samoht opened this issue Mar 31, 2017 · 2 comments
Open

Inotify can raise some errors if init is too fast #10

samoht opened this issue Mar 31, 2017 · 2 comments

Comments

@samoht
Copy link
Member

samoht commented Mar 31, 2017

See https://github.com/dsheets/ocaml-inotify-event/blob/master/src/inotify_events.ml#L38

The fix is too run:

    (* Block until there is something to read. Otherwise, our ioctl
       returns 0 and then makes a 0 read which errors with EINVAL. *)
    ignore (Unix.select [inotify] [] [] ~-.1.);

before calling Inotify.read

@samoht
Copy link
Member Author

samoht commented Mar 31, 2017

/cc @dsheets (who wrote that bit of code) and @whitequark (who maintain the upstream inotify bindings)

@dsheets
Copy link
Member

dsheets commented Mar 31, 2017

I think you mean @whitequark...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants