summaryrefslogtreecommitdiff
path: root/lib/binary-io.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-06-06 08:56:03 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-06-07 00:44:45 -0700
commit111408a0e9eb3a9492c4057ac7d6ddbb8b365aa9 (patch)
tree9b3928219a0a3f0ff4c8fd123bb5b1a2f23df0e2 /lib/binary-io.c
parenta14eb43215b5cbb99175d2b23f582011948b2eaa (diff)
downloademacs-111408a0e9eb3a9492c4057ac7d6ddbb8b365aa9.tar.gz
Update from Gnulib
This incorporates: 2019-06-04 copy-file-range: new module 2019-05-28 binaty-io: O_BINARY on consoles no longer fails * doc/misc/texinfo.tex, lib/binary-io.c, lib/binary-io.h: * lib/unistd.in.h, m4/unistd_h.m4: Copy from Gnulib. * lib/gnulib.mk.in: Regenerate.
Diffstat (limited to 'lib/binary-io.c')
-rw-r--r--lib/binary-io.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/binary-io.c b/lib/binary-io.c
index 01e0bf64765..77490e68e3b 100644
--- a/lib/binary-io.c
+++ b/lib/binary-io.c
@@ -20,18 +20,20 @@
#include "binary-io.h"
#if defined __DJGPP__ || defined __EMX__
-# include <errno.h>
# include <unistd.h>
int
-__gl_setmode_check (int fd)
+set_binary_mode (int fd, int mode)
{
if (isatty (fd))
- {
- errno = EINVAL;
- return -1;
- }
+ /* If FD refers to a console (not a pipe, not a regular file),
+ O_TEXT is the only reasonable mode, both on input and on output.
+ Silently ignore the request. If we were to return -1 here,
+ all programs that use xset_binary_mode would fail when run
+ with console input or console output. */
+ return O_TEXT;
else
- return 0;
+ return __gl_setmode (fd, mode);
}
+
#endif