termbox icon indicating copy to clipboard operation
termbox copied to clipboard

Improper select() error handling

Open mitchellwrosen opened this issue 7 years ago • 3 comments

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.

mitchellwrosen avatar Jul 16 '18 05:07 mitchellwrosen

i guess a patch/PR would be helpful.

rofl0r avatar Jul 16 '18 17:07 rofl0r

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

Darksider3 avatar Mar 09 '19 18:03 Darksider3

SIG_ERR isn't the check.

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

jan-g avatar Jul 07 '19 10:07 jan-g