[vlc-devel] [PATCH 11/11] os2: set to binary mode only if stdin is not a tty
KO Myung-Hun
komh78 at gmail.com
Wed Jan 20 09:49:33 UTC 2021
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.
---
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[] )
--
2.22.0
More information about the vlc-devel
mailing list