CID:1216560 Unchecked return value from ioctl

This commit is contained in:
Michael Jerris 2014-06-02 14:10:59 +00:00
parent ead290870a
commit e992c4c4d8
1 changed files with 4 additions and 4 deletions

View File

@ -139,10 +139,10 @@ static void screen_size(int *x, int *y)
#elif defined(TIOCGWINSZ)
struct winsize w;
ioctl(0, TIOCGWINSZ, &w);
if (x) *x = w.ws_col;
if (y) *y = w.ws_row;
if ( (ioctl(0, TIOCGWINSZ, &w)) >= 0 ) {
if (x) *x = w.ws_col;
if (y) *y = w.ws_row;
}
#else
if (x) *x = 80;
if (y) *y = 24;