aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2014-07-12 10:47:40 +0300
committerEli Zaretskii2014-07-12 10:47:40 +0300
commit2a0bae50e3611a6bd2d584f7a85677b74f1aa71b (patch)
treefcac3a7c15b569bf718b8d49019a3a3ceb3ade82 /src
parentcf90015a108bc5719ce219b281b6952bc9c0ffb4 (diff)
downloademacs-2a0bae50e3611a6bd2d584f7a85677b74f1aa71b.tar.gz
emacs-2a0bae50e3611a6bd2d584f7a85677b74f1aa71b.zip
Minor fix for read_minibuf_noninteractive on MS-Windows.
src/minibuf.c (read_minibuf_noninteractive) [WINDOWSNT]: Switch stdin to binary mode only if it is connected to a terminal. Fixes: debbugs:17839
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/minibuf.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9265051e311..9d5dff49166 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12014-07-12 Eli Zaretskii <eliz@gnu.org>
2
3 * minibuf.c (read_minibuf_noninteractive) [WINDOWSNT]: Switch
4 stdin to binary mode only if it is connected to a terminal.
5
12014-07-11 Paul Eggert <eggert@cs.ucla.edu> 62014-07-11 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Coalesce extern decls. 8 Coalesce extern decls.
diff --git a/src/minibuf.c b/src/minibuf.c
index 1f2fb1fdf3f..e2450b53964 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -241,7 +241,8 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
241 { 241 {
242 emacs_get_tty (fileno (stdin), &etty); 242 emacs_get_tty (fileno (stdin), &etty);
243#ifdef WINDOWSNT 243#ifdef WINDOWSNT
244 _setmode (fileno (stdin), O_BINARY); 244 if (isatty (fileno (stdin)))
245 _setmode (fileno (stdin), O_BINARY);
245#endif 246#endif
246 suppress_echo_on_tty (fileno (stdin)); 247 suppress_echo_on_tty (fileno (stdin));
247 } 248 }
@@ -282,7 +283,8 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
282 fprintf (stdout, "\n"); 283 fprintf (stdout, "\n");
283 emacs_set_tty (fileno (stdin), &etty, 0); 284 emacs_set_tty (fileno (stdin), &etty, 0);
284#ifdef WINDOWSNT 285#ifdef WINDOWSNT
285 _setmode (fileno (stdin), O_TEXT); 286 if (isatty (fileno (stdin)))
287 _setmode (fileno (stdin), O_TEXT);
286#endif 288#endif
287 } 289 }
288 290