Re: [Exim] maildirsize file corruption?

Top Page
Delete this message
Reply to this message
Author: Michael Haardt
Date:  
To: exim-users
Subject: Re: [Exim] maildirsize file corruption?
On Wed, Aug 11, 2004 at 09:40:35AM +0100, Philip Hazel wrote:
> No locking is involved. When creating a new maildirsize file, the data
> is written to a temporary file which is then renamed. When adding a
> single line to an existing file, the logic is
>
> (void)lseek(fd, 0, SEEK_END);
> (void)write(fd, buffer, len);
>
> The file is opened with O_RDWR. Hmm. I wonder if it should be
> O_RDWR+O_APPEND instead?


I think so, but even O_APPEND is not safe on NFS with multiple writing
clients, because NFS does not offer something like O_APPEND and each
client simulates it using the above. Does somebody know if that changed
with NFSv4?

In case an application truncates the file, the above may create a sparse
file, but maildirsize frightens me too much for checking the code. :)

Michael