[vlc-commits] os2: set to binary mode only if stdin is not a tty
KO Myung-Hun
git at videolan.org
Fri Jan 29 14:54:39 UTC 2021
vlc | branch: master | KO Myung-Hun <komh78 at gmail.com> | Wed Jan 20 10:49:00 2021 +0100| [8f1edfab37ab2e1b54f21ef3a8f550159ac6852d] | committer: Steve Lhomme
os2: set to binary mode only if stdin is not a tty
If stdin is binary mode, CR and LF are read respectively. This leads to
unexpected behavior.
For example, control rc generates a command with '\r' first, encounter
'\n' later. This generates an empty command. As a result, unnecessary
status messages are shown.
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8f1edfab37ab2e1b54f21ef3a8f550159ac6852d
---
src/os2/specific.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/os2/specific.c b/src/os2/specific.c
index 173e6325ef..ad9e223fee 100644
--- a/src/os2/specific.c
+++ b/src/os2/specific.c
@@ -140,7 +140,9 @@ void system_Init( void )
{
/* Set the default file-translation mode */
_fmode_bin = 1;
- setmode( fileno( stdin ), O_BINARY ); /* Needed for pipes */
+
+ if( !isatty( fileno( stdin )))
+ setmode( fileno( stdin ), O_BINARY ); /* Needed for pipes */
}
void system_Configure( libvlc_int_t *p_this, int i_argc, const char *const ppsz_argv[] )
More information about the vlc-commits
mailing list