diff options
author | Keith Packard <keithp@keithp.com> | 2020-11-17 15:22:49 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2020-11-17 15:22:49 -0800 |
commit | 09f145bcf13a08a05daf85f75444741ffb78a2bb (patch) | |
tree | 5650f3d09a83e91048d1ac3317c314562bd0f8c5 | |
parent | 95025ea167d87998ef0bd3ed25dfaa2c179cf712 (diff) |
Check return value from ioctl(TIOCGWINSZ)
Make sure the function succeeded before looking at the return value.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | xprop.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -1946,9 +1946,7 @@ main (int argc, char **argv) #ifdef TIOCGWINSZ struct winsize ws; ws.ws_col = 0; - ioctl(STDIN_FILENO, TIOCGWINSZ, &ws); - - if (ws.ws_col != 0) + if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1 && ws.ws_col != 0) term_width = ws.ws_col; #endif |