[Patch, libgfortran] READ from the terminal is broken - 2nd patch - urgent review, please.

Janne Blomqvist jblomqvi@cc.hut.fi
Wed Oct 12 16:43:00 GMT 2005


On Wed, Oct 12, 2005 at 04:08:16PM +0200, Paul Thomas wrote:
> Janne,
> 
> I believe that this is what you intended

No, not really. Your patch still touches fd_seek(). Attached patch is
my proposal for a fix.

Consider it ok:d..


--
Janne Blomqvist
-------------- next part --------------
Index: unix.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/unix.c,v
retrieving revision 1.43
diff -p -u -r1.43 unix.c
--- unix.c	7 Oct 2005 20:02:28 -0000	1.43
+++ unix.c	12 Oct 2005 16:14:27 -0000
@@ -440,7 +440,7 @@ static char *
 fd_alloc_r_at (unix_stream * s, int *len, gfc_offset where)
 {
   gfc_offset m;
-  size_t n;
+  int n;
 
   if (where == -1)
     where = s->logical_offset;
@@ -462,8 +462,8 @@ fd_alloc_r_at (unix_stream * s, int *len
   if (s->physical_offset != m && lseek (s->fd, m, SEEK_SET) < 0)
     return NULL;
 
-  n = s->len - s->active;
-  if (do_read (s, s->buffer + s->active, &n) != 0)
+  n = read (s->fd, s->buffer + s->active, s->len - s->active);
+  if (n < 0)
     return NULL;
 
   s->physical_offset = where + n;


More information about the Fortran mailing list