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

Don't fcntl on an invalid fd. #168

Merged
merged 1 commit into from
Mar 18, 2021
Merged

Don't fcntl on an invalid fd. #168

merged 1 commit into from
Mar 18, 2021

Conversation

rbartlensky
Copy link

Hello! I've stumbled upon an error while using this crate

thread 'main' panicked at 'Failed to initialize inotify.: Os { code: 9, kind: Other, message: "Bad file descriptor" }'

and I figured it's probably because the code doesn't check whether inotify_init returns -1.

Let me know if I need to change anything else!

@hannobraun
Copy link
Owner

Thank you, @rbartlensky, good catch!

I think an even better solution would be to remove the fcntls completely and use inotify_init1 instead. Using inotify_init and fcntl was a workaround for a downstream issue that is no longer required (see #146 and #151 for context). However, this PR is a clear improvement, so I'll merge it.

If you (or anyone else reading this) wants to address #151 in a follow-up PR, that would be very welcome.

@hannobraun hannobraun merged commit d24e9ab into hannobraun:master Mar 18, 2021
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

Successfully merging this pull request may close these issues.

2 participants