Re: Current Samba master incorrectly returns STATUS_INVALID_HANDLE on copy_chunk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 09, 2024 at 10:00:01PM +0200, Ralph Boehme via samba-technical wrote:

Hm, interesting find

But I guess this won't help as with POSIX you can open() a file with O_APPEND but then still call pread/pwrite on the resulting fd.

Is that true ?

The open(2) man page only says:

       O_APPEND
              The file is opened in append mode.  Before each write(2), the file offset is positioned at the end of
              the file, as if with lseek(2).  The modification of the file offset and the write operation are  per‐
              formed as a single atomic step.

Aha ! It's not true (at least on Linux :-).

The pwrite(2) man page says:

BUGS
       POSIX requires that opening a file with the O_APPEND flag should have no effect on  the  location  at  which
       pwrite()  writes  data.   However, on Linux, if a file is opened with O_APPEND, pwrite() appends data to the
       end of the file, regardless of the value of offset.

So FILE_APPEND_DATA|SYNCHRONIZE == O_APPEND, on Linux at least.





[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux