summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-07-17 05:48:48 +0300
committerUoti Urpala <uau@mplayer2.org>2011-07-17 17:05:08 +0300
commitc3e46833c22f1e9ca7de55105881131d00129707 (patch)
tree2449594b2e080c81efec8dcb6bbbc6ae57a01634 /osdep
parent82b8f89baeafc2b2b39381f2ee14e4a2b2619b4c (diff)
downloadmpv-c3e46833c22f1e9ca7de55105881131d00129707.tar.bz2
mpv-c3e46833c22f1e9ca7de55105881131d00129707.tar.xz
input: don't make fd 0 nonblocking
Setting O_NONBLOCK on a file descriptor also affects all other fds that share the same underlying open file description, and in case of stdin such sharing is likely. Making stdin nonblocking can also make stdout nonblocking (they may be the same connection to a terminal), and it can also affect other processes (in "program1 | program2", the shell may give the same terminal connection to program1 as stdin and to program2 as stdout, thus program1 making its stdin nonblocking also turns program2's stdout nonblocking). To avoid these problems stop making fd 0 nonblocking. After the previous commit this should no longer cause problems as long as select() does not spuriously report the fd as readable.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/getch2.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/osdep/getch2.c b/osdep/getch2.c
index 7ddcb3f378..96fe45729a 100644
--- a/osdep/getch2.c
+++ b/osdep/getch2.c
@@ -282,11 +282,6 @@ struct termios tio_new;
tio_new.c_cc[VTIME] = 0;
tcsetattr(0,TCSANOW,&tio_new);
#endif
- /* Setting VMIN above should already make terminal non-blocking; but
- * that won't work if stdin is not a real terminal. */
- int flags = fcntl(0, F_GETFL);
- if (flags != -1)
- fcntl(0, F_SETFL, flags | O_NONBLOCK);
getch2_status=1;
}