aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2010-09-22 03:10:24 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2010-09-22 03:10:24 +0000
commit3bddec9b927ffbd4064cdbb593949b70db07d9b0 (patch)
tree8ebf00fd8e3f39fccd1b3a4dd4ea6f91237c030f
parentefd6aa2ff5a70745f4d4de40ae9b58f11b624097 (diff)
downloadgcc-3bddec9b927ffbd4064cdbb593949b70db07d9b0.zip
gcc-3bddec9b927ffbd4064cdbb593949b70db07d9b0.tar.gz
gcc-3bddec9b927ffbd4064cdbb593949b70db07d9b0.tar.bz2
re PR libfortran/45723 (opening /dev/null for appending writes)
2010-09-21 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/45723 * io/open.c (new_unit): On POSITION_APPEND don't seek if file length is zero. From-SVN: r164507
-rw-r--r--libgfortran/ChangeLog9
-rw-r--r--libgfortran/io/open.c2
2 files changed, 9 insertions, 2 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index bd4243f..8411513 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/45723
+ * io/open.c (new_unit): On POSITION_APPEND don't seek if file length is
+ zero.
+
2010-09-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/45532
@@ -6,7 +12,8 @@
2010-09-12 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
- * intrinsics/pack_generic.c (pack): Add missing return and fix whitespace.
+ * intrinsics/pack_generic.c (pack): Add missing return and fix
+ whitespace.
* intrinsics/cshift0.c (cshift0): Fix whitespace.
* intrinsics/unpack_generic.c (unpack1, unpack0): Fix whitespace.
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index be8f4bb..d7448c0 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -555,7 +555,7 @@ 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)
+ if (file_size (opp->file, opp->file_len) > 0 && sseek (u->s, 0, SEEK_END) < 0)
generate_error (&opp->common, LIBERROR_OS, NULL);
u->endfile = AT_ENDFILE;
}