brian-armstrong / gpio

Go library to do GPIO on systems with /sys/class/gpio (sysfs)
BSD 3-Clause "New" or "Revised" License
140 stars 50 forks source link

Fix watcher bug (incorrect fdset when watching with select) #7

Closed olb17 closed 6 years ago

olb17 commented 6 years ago

Fixing issue #1

brian-armstrong commented 6 years ago

Thanks for the PR.

It's weird, I vaguely remember looking into this issue, and even writing code similar to this. I even thought I had committed it, but I can't find any trace of that, so maybe I just imagined I did. Thanks for the fix!

brian-armstrong commented 6 years ago

Also, for my own edification, did this just affect FDs greater than 63?

olb17 commented 6 years ago

This affected all fd where 2^fd >= 64 . So fd >= 6. The watcher only worked for fd 3 4 or 5 (considering 0 1 & 2 are already used for stdin stdout and stderr). In my case, it failed for fd == 9.

Le 16 janv. 2018 1:58 AM, "Brian Armstrong" notifications@github.com a écrit :

Also, for my own edification, did this just affect FDs greater than 63?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brian-armstrong/gpio/pull/7#issuecomment-357823164, or mute the thread https://github.com/notifications/unsubscribe-auth/ACVwtHOwN6vaqC0aLVJzpMbyvXFSonIgks5tK_QrgaJpZM4Re_3- .

brian-armstrong commented 6 years ago

Yikes, that's quite a lot more broken than I realized. Thanks for the PR!