summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrr- <rr-@sakuya.pl>2017-02-20 14:14:35 +0100
committerwm4 <wm4@nowhere>2017-02-20 14:19:57 +0100
commit326920a9bf76be562ae65c55609edf65072129ad (patch)
tree8cfb15913d7bac81ad5f8e3816bd2ff7f154148e
parent8c701587c84b6d304d2410dae5e8bc54ca6f5aa4 (diff)
downloadmpv-326920a9bf76be562ae65c55609edf65072129ad.tar.bz2
mpv-326920a9bf76be562ae65c55609edf65072129ad.tar.xz
vo_tct: check ioctl result
-rw-r--r--video/out/vo_tct.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/video/out/vo_tct.c b/video/out/vo_tct.c
index 68b29e9bc8..dbe5d69fb6 100644
--- a/video/out/vo_tct.c
+++ b/video/out/vo_tct.c
@@ -177,14 +177,14 @@ static void write_half_blocks(
static void get_win_size(struct vo *vo, int *out_width, int *out_height) {
struct priv *p = vo->priv;
-#if HAVE_POSIX
- struct winsize winsize;
- ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize);
- *out_width = winsize.ws_col;
- *out_height = winsize.ws_row;
-#else
*out_width = DEFAULT_WIDTH;
*out_height = DEFAULT_HEIGHT;
+#if HAVE_POSIX
+ struct winsize winsize;
+ if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) >= 0) {
+ *out_width = winsize.ws_col;
+ *out_height = winsize.ws_row;
+ }
#endif
if (p->opts->width > 0)