diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-07 21:25:40 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-07 21:25:40 +0000 |
commit | cf55c3cf6a36a55f8dcad17b8ddfac168fb7af08 (patch) | |
tree | 077176970c902eb386a3e59797dc9538ca553d80 /libgfortran/io | |
parent | 488c408f0fd890ce2e9afd87a2e851e00c2b0519 (diff) | |
download | gcc-cf55c3cf6a36a55f8dcad17b8ddfac168fb7af08.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104009 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io')
-rw-r--r-- | libgfortran/io/transfer.c | 13 | ||||
-rw-r--r-- | libgfortran/io/unix.c | 9 |
2 files changed, 21 insertions, 1 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 59eb22d3dec..9251cf8f24f 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1422,13 +1422,24 @@ next_record_w (void) break; case FORMATTED_SEQUENTIAL: +#ifdef HAVE_CRLF + length = 2; +#else length = 1; +#endif p = salloc_w (current_unit->s, &length); if (!is_internal_unit()) { if (p) - *p = '\n'; /* No CR for internal writes. */ + { /* No new line for internal writes. */ +#ifdef HAVE_CRLF + p[0] = '\r'; + p[1] = '\n'; +#else + *p = '\n'; +#endif + } else goto io_error; } 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) |