Ensure only DOSish builds force O_BINARY=1 in the open path
authorPaul Green <Paul.Green@stratus.com>
Tue, 19 Mar 2013 03:43:25 +0000 (23:43 -0400)
committerKarl Williamson <public@khwilliamson.com>
Tue, 19 Mar 2013 21:45:46 +0000 (15:45 -0600)
perlio.c

index 097bc49..d356a7b 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -2610,10 +2610,15 @@ PerlIOUnix_oflags(const char *mode)
        oflags &= ~O_BINARY;
        mode++;
     }
-    /*
-     * Always open in binary mode
-     */
-    oflags |= O_BINARY;
+    else {
+#ifdef PERLIO_USING_CRLF
+       /*
+        * If neither "t" nor "b" was specified, open the file
+        * in O_BINARY mode.
+        */
+       oflags |= O_BINARY;
+#endif
+    }
     if (*mode || oflags == -1) {
        SETERRNO(EINVAL, LIB_INVARG);
        oflags = -1;