From: hlu@luke.eecs.wsu.edu (H.J. Lu)
Subject: Re: Library 4.1 bug/feature? fopen("fifo","a") fails
Date: Fri, 8 Jan 1993 07:23:23 GMT
In article <1993Jan8.053556.24868@daffy.cs.wisc.edu> quale@spock.cs.wisc.edu (Doug Quale) writes:
>In article <1993Jan7.104939.10424@serval.net.wsu.edu> hlu@luke.eecs.wsu.edu (H.J. Lu) writes:
>>In article <1igs2mINNdpp@nz12.rz.uni-karlsruhe.de> ig25@rz.uni-karlsruhe.de writes:
>>>Is it a bug or a feature that fopen("fifo","a"), where "fifo" is a named
>>>pipe, fails with an 'illegal lseek' in the 4.1 version of the library?
>>>The opinion on comp.std.unix seems to be that there should be no
>>>problem...
>>
>>That is a feature of stdio/kernel. I was told that according to ANSI
>>standard, fopen ("foo", "a") should do a lseek () to the end after
>>calling open (). But linux kernel refuses to any lseek () on
>>non-regular files.
>>
>
>If iostream works this way, it is broken, because fopen ("foo", "a")
>is *not* an open followed by an lseek. The open must be in O_APPEND mode
>or files writen by several processes will lose horribly.
>
>To the specific point asked, I believe that lseeks are not permitted on
>pipes, named or otherwise, and so it is not a bug that Linux disallows
>O_APPEND mode on pipes. But if iostream really does an lseek for
>fopen ("foo", "a") that should be fixed.
>--
>Doug Quale
>quale@saavik.cs.wisc.edu
It should be said "reverse what was done to iostream". I believe
fopen ("foo", "a") means open "foo" and set r/w pointer at the
end of the file.
H.J.