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
This commit is contained in:
Jerry DeLisle 2010-09-22 03:10:24 +00:00
parent efd6aa2ff5
commit 3bddec9b92
2 changed files with 9 additions and 2 deletions

View File

@ -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.

View File

@ -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;
}