cppfiles.c (open_file): Change mode (DJGPP only) of redirected input to O_BINARY.
authorAndris Pavenis <pavenis@lanet.lv>
Mon, 13 May 2002 20:28:28 +0000 (23:28 +0300)
committerNeil Booth <neil@gcc.gnu.org>
Mon, 13 May 2002 20:28:28 +0000 (20:28 +0000)
* cppfiles.c (open_file): Change mode (DJGPP only) of redirected
input to O_BINARY.

From-SVN: r53431

gcc/ChangeLog
gcc/cppfiles.c

index bf1fd086f1066c32993423c0c041f25890c39c72..17494dcf9b37392fbce00c5dbca70d225a94f8c4 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-13  Andris Pavenis  <pavenis@lanet.lv>
+
+       * cppfiles.c (open_file): Change mode (DJGPP only) of redirected
+       input to O_BINARY.
+
 2002-05-13  Jeffrey A Law  (law@redhat.com)
 
        * i386.c (ia32_multipass_dfa_lookahead): Prototype.
index 70ac9782f4de287834ae1f5255abc236c0d977d1..49c740dea4a2350f3cc9d554b4f0c6b64d7b268d 100644 (file)
@@ -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);