summaryrefslogtreecommitdiff
path: root/libgfortran/io/unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r--libgfortran/io/unix.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 69101efff04..87b839b6dd3 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -1000,7 +1000,12 @@ tempfile (void)
if (mktemp (template))
do
+#ifdef HAVE_CRLF
+ fd = open (template, O_RDWR | O_CREAT | O_EXCL | O_BINARY,
+ S_IREAD | S_IWRITE);
+#else
fd = open (template, O_RDWR | O_CREAT | O_EXCL, S_IREAD | S_IWRITE);
+#endif
while (!(fd == -1 && errno == EEXIST) && mktemp (template));
else
fd = -1;
@@ -1085,6 +1090,10 @@ regular_file (unit_flags *flags)
/* rwflag |= O_LARGEFILE; */
+#ifdef HAVE_CRLF
+ crflag |= O_BINARY;
+#endif
+
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
fd = open (path, rwflag | crflag, mode);
if (flags->action != ACTION_UNSPECIFIED)