diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-09-07 23:25:40 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-09-07 21:25:40 +0000 |
commit | 3c12752024a356b71760e09560f5ae6f430fca27 (patch) | |
tree | 077176970c902eb386a3e59797dc9538ca553d80 /libgfortran/io/unix.c | |
parent | 2a0abeaf5523ab73d62cd6d84d78e34a25117ecd (diff) | |
download | gcc-3c12752024a356b71760e09560f5ae6f430fca27.zip gcc-3c12752024a356b71760e09560f5ae6f430fca27.tar.gz gcc-3c12752024a356b71760e09560f5ae6f430fca27.tar.bz2 |
re PR libfortran/23262 ([mingw32] rewind truncates file)
PR libfortran/23262
* acinclude.m4 (LIBGFOR_CHECK_CRLF): New check.
* configure.ac: Use new check.
* configure.in: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
* io/transfer.c (next_record_w): Add case for CRLF as line
terminator.
* io/unix.c (tempfile, regular_file): Open files with
O_BINARY on systems with CRLF.
From-SVN: r104009
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r-- | libgfortran/io/unix.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 69101ef..87b839b 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) |