[Bug libfortran/30162] [4.7/4.8 Regression] I/O with named pipes does not work on Darwin

jb at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 18 20:17:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30162

--- Comment #46 from Janne Blomqvist <jb at gcc dot gnu.org> 2013-02-18 20:16:28 UTC ---
(In reply to comment #44)
> If unformatted sequential ever worked, it was by chance.
> 
> Look at this piece of code:
> 
>   /* Seek to the head and overwrite the bogus length with the real
>      length.  */
> 
>   if (unlikely (sseek (dtp->u.p.current_unit->s, - m - 2 * record_marker, 
>                SEEK_CUR) < 0))
>     goto io_error;
> 
> This works if it happens within a buffer, but you cannot rely on that.
> 
> I would therefore suggest to resolve this PR by issuing a well-defined
> error if we encounter a pipe on opening.
> 
> I'll prepare a patch.

As I explained in comment #23, this is already handled. When opening a file, we
stat() the fd, and use the buffered I/O functions only if it's a regular file,
otherwise the unbuffered raw I/O functions are used.



More information about the Gcc-bugs mailing list