On Sun, Feb 24, 2013 at 09:12, Sachidananda wrote:
> 
>> Also, for the record, it's open that seeks to the end.  You can open a
>> file with O_APPEND and seek back to the beginning, and write will not
>> seek to the end again.
> My observation is, if I open(2) the file with O_APPEND it seeks to the
> end. And I lseek back to the beginning and write(2) to it, write does
> seek back to the end and write the data at the end.

No, I apologize.  I'm the one who's wrong.  The O_APPEND flag is
sticky, and continues to affect the file even after seeking.  This
probably is worth documenting.  The current write man page is
misleading, even.  Checking the source, pwrite is not affected by the
flag.  That'd be worth mentioning too.



Reply via email to