aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 70ac978..49c740d 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -270,7 +270,15 @@ open_file (pfile, filename)
Special case: the empty string is translated to stdin. */
if (filename[0] == '\0')
- file->fd = 0;
+ {
+ file->fd = 0;
+#ifdef __DJGPP__
+ /* For DJGPP redirected input is opened in text mode. Change it
+ to binary mode. */
+ if (! isatty (file->fd))
+ setmode (file->fd, O_BINARY);
+#endif
+ }
else
file->fd = open (file->name, O_RDONLY | O_NOCTTY | O_BINARY, 0666);