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

posix: don't process events when read returns < 0 #48

Merged
merged 1 commit into from Mar 10, 2017
Merged

posix: don't process events when read returns < 0 #48

merged 1 commit into from Mar 10, 2017

Conversation

@catfact
Copy link
Contributor

@catfact catfact commented Mar 10, 2017

i'm using libmonome to read directly from a serial device on linux.

much to my surprise, at a certain point in the project i started getting segfaults and spurious callbacks on device disconnect, which i never saw before.

currently my test device is a latest-edition 128.

after digging a bit, i found that next_event() is returning -1 (ultimately from here), but the event loop just checks for logical zero, so it continues with a bogus event structure, which may or may not blow up spectacularly.

here's a minimal patch that works for me, but maybe there's a better solution

@wrl wrl merged commit 77caf0f into master Mar 10, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@wrl
Copy link
Member

@wrl wrl commented Mar 10, 2017

Nope, looks good to me. monome_platform_read() can definitely return a negative, so this was just sloppy coding on my part.

Thanks.

@catfact catfact deleted the posix-read-fix branch Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants