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

Improper select() error handling #115

Open
mitchellwrosen opened this issue Jul 16, 2018 · 3 comments
Open

Improper select() error handling #115

mitchellwrosen opened this issue Jul 16, 2018 · 3 comments

Comments

@mitchellwrosen
Copy link

termbox/src/termbox.c

Lines 653 to 655 in bbb64e9

int result = select(maxfd+1, &events, 0, 0, timeout);
if (!result)
return 0;

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

@rofl0r
Copy link
Contributor

rofl0r commented Jul 16, 2018

i guess a patch/PR would be helpful.

@Darksider3
Copy link

Darksider3 commented Mar 9, 2019

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

@jan-g
Copy link

jan-g commented Jul 7, 2019

SIG_ERR isn't the check.

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

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

No branches or pull requests

4 participants