nsf / termbox

Library for writing text-based user interfaces
http://code.google.com/p/termbox
MIT License
1.96k stars 185 forks source link

Improper select() error handling #115

Open mitchellwrosen opened 6 years ago

mitchellwrosen commented 6 years ago

https://github.com/nsf/termbox/blob/bbb64e9da7c5590dc7657eb1bece562089656dc1/src/termbox.c#L653-L655

select returns -1 on error, which is never checked. This makes the function unresponsive to OS signals (EINTR), among other things.

rofl0r commented 6 years ago

i guess a patch/PR would be helpful.

Darksider3 commented 5 years ago

Any reason why a simple if(result==SIG_ERR) return 0; didnt made it in yet, or shall i do that one? ^^

jan-g commented 5 years ago

SIG_ERR isn't the check.

if (result == -1 && errno == EINTR) ...