aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorAndris Pavenis <pavenis@lanet.lv>2002-05-13 23:28:28 +0300
committerNeil Booth <neil@gcc.gnu.org>2002-05-13 20:28:28 +0000
commit85be8c2de8b3e36434fe0504beb95502350180ce (patch)
tree19addda9e4e7b9df7d6c2cb32a1fad30fd5e0918 /gcc/cppfiles.c
parent859f7aaf4122e4a2560153d0458371e556da2dc7 (diff)
downloadgcc-85be8c2de8b3e36434fe0504beb95502350180ce.zip
gcc-85be8c2de8b3e36434fe0504beb95502350180ce.tar.gz
gcc-85be8c2de8b3e36434fe0504beb95502350180ce.tar.bz2
cppfiles.c (open_file): Change mode (DJGPP only) of redirected input to O_BINARY.
* cppfiles.c (open_file): Change mode (DJGPP only) of redirected input to O_BINARY. From-SVN: r53431
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);