Commit 35077d5a by Jerry DeLisle

re PR fortran/35632 (stream io broken on FreeBSD due to ftruncate changes.)

2008-03-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35632
	* io/transfer.c (data_transfer_init):  Fix whitespace.
	(next_record_w): Truncate the file only if the stream
	position is short of the file end.

From-SVN: r133454
parent 1b738915
2008-03-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/35632
* io/transfer.c (data_transfer_init): Fix whitespace.
(next_record_w): Truncate the file only if the stream
position is short of the file end.
2008-03-21 Jerry DeLisle <jvdelisle@gcc.gnu.org> 2008-03-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* intrinsics/pack_generic.c: Fix typo. * intrinsics/pack_generic.c: Fix typo.
......
...@@ -1985,12 +1985,12 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) ...@@ -1985,12 +1985,12 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
if (dtp->u.p.mode == READING if (dtp->u.p.mode == READING
&& dtp->u.p.current_unit->mode == WRITING && dtp->u.p.current_unit->mode == WRITING
&& !is_internal_unit (dtp)) && !is_internal_unit (dtp))
flush(dtp->u.p.current_unit->s); flush(dtp->u.p.current_unit->s);
/* Check whether the record exists to be read. Only /* Check whether the record exists to be read. Only
a partial record needs to exist. */ a partial record needs to exist. */
if (dtp->u.p.mode == READING && (dtp->rec -1) if (dtp->u.p.mode == READING && (dtp->rec - 1)
* dtp->u.p.current_unit->recl >= file_length (dtp->u.p.current_unit->s)) * dtp->u.p.current_unit->recl >= file_length (dtp->u.p.current_unit->s))
{ {
generate_error (&dtp->common, LIBERROR_BAD_OPTION, generate_error (&dtp->common, LIBERROR_BAD_OPTION,
...@@ -2604,7 +2604,9 @@ next_record_w (st_parameter_dt *dtp, int done) ...@@ -2604,7 +2604,9 @@ next_record_w (st_parameter_dt *dtp, int done)
if (is_stream_io (dtp)) if (is_stream_io (dtp))
{ {
dtp->u.p.current_unit->strm_pos += len; dtp->u.p.current_unit->strm_pos += len;
struncate(dtp->u.p.current_unit->s); if (dtp->u.p.current_unit->strm_pos
< file_length (dtp->u.p.current_unit->s))
struncate (dtp->u.p.current_unit->s);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment