------- Comment #10 from tkoenig at gcc dot gnu dot org 2007-01-02 22:08 ------- (In reply to comment #9)
> Preliminary patch for formatted only. Looks pretty good, at least the tests pass. > Index: io/unix.c > =================================================================== > *** io/unix.c (revision 120301) > --- io/unix.c (working copy) > *************** fd_flush (unix_stream * s) > *** 349,355 **** > size_t writelen; > > if (s->ndirty == 0) > ! return SUCCESS;; > > if (s->physical_offset != s->dirty_offset && > lseek (s->fd, s->dirty_offset, SEEK_SET) < 0) > --- 349,358 ---- > size_t writelen; > > if (s->ndirty == 0) > ! return SUCCESS; > ! > ! if (s->file_length == -1) > ! return SUCCESS; I don't understand this part. Shouldn't we flush the buffer anyway, even without a seek? > fd_truncate (unix_stream * s) > { > if (lseek (s->fd, s->logical_offset, SEEK_SET) == -1) > ! return SUCCESS; A small matter, we should test for seekable files first: if (s->file_length == -1) return SUCCESS; if (lseek(s->fd, s->logical_offset, SEEK_SET) == -1) return FAILURE; If this fails, something is really wrong. As an aside, this already works for ACCESS="stream" and unformatted files, so I think we should think about committing this. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30162