summaryrefslogtreecommitdiff
path: root/libgfortran/io
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io')
-rw-r--r--libgfortran/io/close.c2
-rw-r--r--libgfortran/io/fbuf.c2
-rw-r--r--libgfortran/io/fbuf.h2
-rw-r--r--libgfortran/io/file_pos.c8
-rw-r--r--libgfortran/io/format.c2
-rw-r--r--libgfortran/io/format.h2
-rw-r--r--libgfortran/io/inquire.c2
-rw-r--r--libgfortran/io/intrinsics.c2
-rw-r--r--libgfortran/io/io.h2
-rw-r--r--libgfortran/io/list_read.c2
-rw-r--r--libgfortran/io/lock.c2
-rw-r--r--libgfortran/io/open.c79
-rw-r--r--libgfortran/io/read.c6
-rw-r--r--libgfortran/io/size_from_kind.c2
-rw-r--r--libgfortran/io/transfer.c10
-rw-r--r--libgfortran/io/transfer128.c2
-rw-r--r--libgfortran/io/unit.c2
-rw-r--r--libgfortran/io/unix.c4
-rw-r--r--libgfortran/io/unix.h2
-rw-r--r--libgfortran/io/write.c2
-rw-r--r--libgfortran/io/write_float.def2
21 files changed, 78 insertions, 61 deletions
diff --git a/libgfortran/io/close.c b/libgfortran/io/close.c
index fa9c1137f03..63da0c420cd 100644
--- a/libgfortran/io/close.c
+++ b/libgfortran/io/close.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran).
diff --git a/libgfortran/io/fbuf.c b/libgfortran/io/fbuf.c
index ace990db821..170ce9754c9 100644
--- a/libgfortran/io/fbuf.c
+++ b/libgfortran/io/fbuf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2014 Free Software Foundation, Inc.
Contributed by Janne Blomqvist
This file is part of the GNU Fortran runtime library (libgfortran).
diff --git a/libgfortran/io/fbuf.h b/libgfortran/io/fbuf.h
index d125a2cf6e1..253b2adcf84 100644
--- a/libgfortran/io/fbuf.h
+++ b/libgfortran/io/fbuf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2014 Free Software Foundation, Inc.
Contributed by Janne Blomqvist
This file is part of the GNU Fortran runtime library (libgfortran).
diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
index 8b4fda3dd91..85183a6632d 100644
--- a/libgfortran/io/file_pos.c
+++ b/libgfortran/io/file_pos.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught and Janne Blomqvist
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -410,7 +410,11 @@ st_rewind (st_parameter_filepos *fpp)
u->last_record = 0;
if (sseek (u->s, 0, SEEK_SET) < 0)
- generate_error (&fpp->common, LIBERROR_OS, NULL);
+ {
+ generate_error (&fpp->common, LIBERROR_OS, NULL);
+ library_end ();
+ return;
+ }
/* Set this for compatibilty with g77 for /dev/null. */
if (ssize (u->s) == 0)
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index d5a3548bc30..83f291ec2de 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
F2003 I/O support contributed by Jerry DeLisle
diff --git a/libgfortran/io/format.h b/libgfortran/io/format.h
index 529b93e9804..2f2231f359e 100644
--- a/libgfortran/io/format.h
+++ b/libgfortran/io/format.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2014 Free Software Foundation, Inc.
Contributed by Janne Blomqvist
This file is part of the GNU Fortran runtime library (libgfortran).
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c
index d91982a65b7..b12ee510085 100644
--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of the GNU Fortran runtime library (libgfortran).
diff --git a/libgfortran/io/intrinsics.c b/libgfortran/io/intrinsics.c
index 1573434d6db..5c07ca39eda 100644
--- a/libgfortran/io/intrinsics.c
+++ b/libgfortran/io/intrinsics.c
@@ -1,6 +1,6 @@
/* Implementation of the FGET, FGETC, FPUT, FPUTC, FLUSH
FTELL, TTYNAM and ISATTY intrinsics.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 Free Software Foundation, Inc.
This file is part of the GNU Fortran runtime library (libgfortran).
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index 1dcf72e7163..97f7a6a2abd 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
F2003 I/O support contributed by Jerry DeLisle
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index d38a4a8d0b4..a37cfcb26c2 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
Namelist input contributed by Paul Thomas
F2003 I/O support contributed by Jerry DeLisle
diff --git a/libgfortran/io/lock.c b/libgfortran/io/lock.c
index dbb61a7dccb..2208abdcddf 100644
--- a/libgfortran/io/lock.c
+++ b/libgfortran/io/lock.c
@@ -1,5 +1,5 @@
/* Thread/recursion locking
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org> and Andy Vaught
This file is part of the GNU Fortran runtime library (libgfortran).
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index cca0ecc714f..02c3f5a165d 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
F2003 I/O support contributed by Jerry DeLisle
@@ -265,39 +265,39 @@ edit_modes (st_parameter_open *opp, gfc_unit * u, unit_flags * flags)
u->flags.round = flags->round;
if (flags->sign != SIGN_UNSPECIFIED)
u->flags.sign = flags->sign;
- }
-
- /* Reposition the file if necessary. */
-
- switch (flags->position)
- {
- case POSITION_UNSPECIFIED:
- case POSITION_ASIS:
- break;
-
- case POSITION_REWIND:
- if (sseek (u->s, 0, SEEK_SET) != 0)
- goto seek_error;
-
- u->current_record = 0;
- u->last_record = 0;
-
- test_endfile (u);
- break;
- case POSITION_APPEND:
- if (sseek (u->s, 0, SEEK_END) < 0)
- goto seek_error;
-
- if (flags->access != ACCESS_STREAM)
- u->current_record = 0;
-
- u->endfile = AT_ENDFILE; /* We are at the end. */
- break;
-
- seek_error:
- generate_error (&opp->common, LIBERROR_OS, NULL);
- break;
+ /* Reposition the file if necessary. */
+
+ switch (flags->position)
+ {
+ case POSITION_UNSPECIFIED:
+ case POSITION_ASIS:
+ break;
+
+ case POSITION_REWIND:
+ if (sseek (u->s, 0, SEEK_SET) != 0)
+ goto seek_error;
+
+ u->current_record = 0;
+ u->last_record = 0;
+
+ test_endfile (u);
+ break;
+
+ case POSITION_APPEND:
+ if (sseek (u->s, 0, SEEK_END) < 0)
+ goto seek_error;
+
+ if (flags->access != ACCESS_STREAM)
+ u->current_record = 0;
+
+ u->endfile = AT_ENDFILE; /* We are at the end. */
+ break;
+
+ seek_error:
+ generate_error (&opp->common, LIBERROR_OS, NULL);
+ break;
+ }
}
unlock_unit (u);
@@ -562,7 +562,10 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags)
if (flags->position == POSITION_APPEND)
{
if (sseek (u->s, 0, SEEK_END) < 0)
- generate_error (&opp->common, LIBERROR_OS, NULL);
+ {
+ generate_error (&opp->common, LIBERROR_OS, NULL);
+ goto cleanup;
+ }
u->endfile = AT_ENDFILE;
}
@@ -852,8 +855,12 @@ st_open (st_parameter_open *opp)
{
u = find_unit (opp->common.unit);
if (u == NULL) /* Negative unit and no NEWUNIT-created unit found. */
- generate_error (&opp->common, LIBERROR_BAD_OPTION,
- "Bad unit number in OPEN statement");
+ {
+ generate_error (&opp->common, LIBERROR_BAD_OPTION,
+ "Bad unit number in OPEN statement");
+ library_end ();
+ return;
+ }
}
if (u == NULL)
diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c
index e35b1a06168..331edc23d39 100644
--- a/libgfortran/io/read.c
+++ b/libgfortran/io/read.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
F2003 I/O support contributed by Jerry DeLisle
@@ -1150,7 +1150,9 @@ done:
exponent = - exponent;
}
- assert (exponent < 10000);
+ if (exponent >= 10000)
+ goto bad_float;
+
for (dig = 3; dig >= 0; --dig)
{
out[dig] = (char) ('0' + exponent % 10);
diff --git a/libgfortran/io/size_from_kind.c b/libgfortran/io/size_from_kind.c
index 8bf992eb3f0..5768c91e5ff 100644
--- a/libgfortran/io/size_from_kind.c
+++ b/libgfortran/io/size_from_kind.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2014 Free Software Foundation, Inc.
Contributed by Janne Blomqvist
This file is part of the GNU Fortran runtime library (libgfortran).
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 0b1540ce2af..87415d5cc7c 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
Namelist transfer functions contributed by Paul Thomas
F2003 I/O support contributed by Jerry DeLisle
@@ -2490,14 +2490,18 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
if ((cf & IOPARM_DT_HAS_NAMELIST_NAME) != 0 && dtp->u.p.ionml != NULL)
{
if ((cf & IOPARM_DT_HAS_FORMAT) != 0)
- generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
- "A format cannot be specified with a namelist");
+ {
+ generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
+ "A format cannot be specified with a namelist");
+ return;
+ }
}
else if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED &&
!(cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT)))
{
generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
"Missing format for FORMATTED data transfer");
+ return;
}
if (is_internal_unit (dtp)
diff --git a/libgfortran/io/transfer128.c b/libgfortran/io/transfer128.c
index 962a700b4f7..6735ca51cb0 100644
--- a/libgfortran/io/transfer128.c
+++ b/libgfortran/io/transfer128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2014 Free Software Foundation, Inc.
This file is part of the GNU Fortran runtime library (libgfortran).
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index f8c1516e0c7..f9b594d0ce3 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
F2003 I/O support contributed by Jerry DeLisle
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index c2bc28aed15..9f78b62257d 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
F2003 I/O support contributed by Jerry DeLisle
@@ -1124,7 +1124,7 @@ tempfile_open (const char *tempdir, char **fname)
#endif
#if defined(HAVE_MKOSTEMP) && defined(O_CLOEXEC)
- fd = mkostemp (template, O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC);
+ fd = mkostemp (template, O_CLOEXEC);
#else
fd = mkstemp (template);
set_close_on_exec (fd);
diff --git a/libgfortran/io/unix.h b/libgfortran/io/unix.h
index cc82d457397..37561108c80 100644
--- a/libgfortran/io/unix.h
+++ b/libgfortran/io/unix.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2014 Free Software Foundation, Inc.
Contributed by Janne Blomqvist
This file is part of the GNU Fortran runtime library (libgfortran).
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 153da2e2038..61b5691d619 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
Namelist output contributed by Paul Thomas
F2003 I/O support contributed by Jerry DeLisle
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index b634ff54f0b..f8e23e91753 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2014 Free Software Foundation, Inc.
Contributed by Andy Vaught
Write float code factoring to this file by Jerry DeLisle
F2003 I/O support contributed by Jerry DeLisle