summaryrefslogtreecommitdiff
path: root/lib/binary-io.c
diff options
context:
space:
mode:
authorClint Adams <clint@debian.org>2021-08-31 08:53:27 -0400
committerClint Adams <clint@debian.org>2021-08-31 08:53:27 -0400
commitf24d9c72cbde1abddef18e427b818e5b6266a5e0 (patch)
treef10e939c9cb7b767cb51dce4a84ec9872f3c61b1 /lib/binary-io.c
parentc7cd1604feb9bce8b62e9a5a306b8eeb30a11c97 (diff)
parentc50de48f2ed0b9476c3389fd07a85a5e8be798e2 (diff)
Update upstream source from tag 'upstream/v4.8'
Update to upstream version '4.8' with Debian dir 33bfe3afa4d1f33d660b71d89a5ac3eba646cc82
Diffstat (limited to 'lib/binary-io.c')
-rw-r--r--lib/binary-io.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/binary-io.c b/lib/binary-io.c
index f9cc4dd..e84e223 100644
--- a/lib/binary-io.c
+++ b/lib/binary-io.c
@@ -1,5 +1,5 @@
/* Binary mode I/O.
- Copyright 2017-2018 Free Software Foundation, Inc.
+ Copyright 2017-2020 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -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