re PR libfortran/26423 (Error on binary I/O for large array)

2006-02-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26423
	* io/unix.c (fd_seek): Revert change from 25949.
	(fd_read): Same.
	(fd_write): Same.

From-SVN: r111420
This commit is contained in:
Jerry DeLisle 2006-02-24 18:16:25 +00:00
parent 69ca354913
commit c5418dcb96
2 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2006-02-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/26423
* io/unix.c (fd_seek): Revert change from 25949.
(fd_read): Same.
(fd_write): Same.
2006-02-19 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* io/open.c (edit_modes): Correct abusive copy-pasting.

View File

@ -561,12 +561,18 @@ fd_sfree (unix_stream * s)
static try
fd_seek (unix_stream * s, gfc_offset offset)
{
if (s->physical_offset == offset) /* Are we lucky and avoid syscall? */
{
s->logical_offset = offset;
return SUCCESS;
}
s->physical_offset = s->logical_offset = offset;
return (lseek (s->fd, offset, SEEK_SET) < 0) ? FAILURE : SUCCESS;
}
/* truncate_file()-- Given a unit, truncate the file at the current
* position. Sets the physical location to the new end of the file.
@ -666,8 +672,7 @@ fd_read (unix_stream * s, void * buf, size_t * nbytes)
return errno;
}
if (is_seekable ((stream *) s) && s->physical_offset != s->logical_offset
&& lseek (s->fd, s->logical_offset, SEEK_SET) < 0)
if (is_seekable ((stream *) s) && fd_seek (s, s->logical_offset) == FAILURE)
{
*nbytes = 0;
return errno;
@ -715,8 +720,7 @@ fd_write (unix_stream * s, const void * buf, size_t * nbytes)
return errno;
}
if (is_seekable ((stream *) s) && s->physical_offset != s->logical_offset
&& lseek (s->fd, s->logical_offset, SEEK_SET) < 0)
if (is_seekable ((stream *) s) && fd_seek (s, s->logical_offset) == FAILURE)
{
*nbytes = 0;
return errno;