diff options
Diffstat (limited to 'lib/binary-io.c')
| -rw-r--r-- | lib/binary-io.c | 16 |
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 @@ | |||
| 20 | #include "binary-io.h" | 20 | #include "binary-io.h" |
| 21 | 21 | ||
| 22 | #if defined __DJGPP__ || defined __EMX__ | 22 | #if defined __DJGPP__ || defined __EMX__ |
| 23 | # include <errno.h> | ||
| 24 | # include <unistd.h> | 23 | # include <unistd.h> |
| 25 | 24 | ||
| 26 | int | 25 | int |
| 27 | __gl_setmode_check (int fd) | 26 | set_binary_mode (int fd, int mode) |
| 28 | { | 27 | { |
| 29 | if (isatty (fd)) | 28 | if (isatty (fd)) |
| 30 | { | 29 | /* If FD refers to a console (not a pipe, not a regular file), |
| 31 | errno = EINVAL; | 30 | O_TEXT is the only reasonable mode, both on input and on output. |
| 32 | return -1; | 31 | Silently ignore the request. If we were to return -1 here, |
| 33 | } | 32 | all programs that use xset_binary_mode would fail when run |
| 33 | with console input or console output. */ | ||
| 34 | return O_TEXT; | ||
| 34 | else | 35 | else |
| 35 | return 0; | 36 | return __gl_setmode (fd, mode); |
| 36 | } | 37 | } |
| 38 | |||
| 37 | #endif | 39 | #endif |