Hi -

I had a look at the new code and it looks much closer to the Maildir
algorithm now. I think you could still put a call to fsync() before
the file close() function call to ensure the file has been written to
the drive and not to the local cache. This gives you something like:

    /* done with the new file */
    if ( is_file == 1) {
        if(fsync(write_fd) == -1 || close(write_fd) == -1) {
            if ( unlink(local_file) != 0 ) {
                printf("unlink failed %s errno = %d\n",
                       local_file, errno);
                return(errno);
            }

            printf("fsync/close failed %s errno = %d\n",
                           local_file, errno);
            return(errno);
        }
    } else
        close(write_fd);

(around line 529 of vdelivermail.c). Now you can pretty much guarantee
that the tmp file is written to the drive. You may be able to use
fdatasync() if you want to optimise this as that will leave out a
write operation to update the modification time on the inode and just
writes the data out to disk but how much time that will save I dont
know.

Hope this is of use,

Marcus


> -----Original Message-----
> From: Ken Jones [mailto:[EMAIL PROTECTED]]
> Sent: 05 June 2001 15:56
> To: [EMAIL PROTECTED]
> Subject: Re: Vdelivermail, Maildir support and NFS 'safety'
>
>
>
> Oops, I forgot to put a url. It has been a long day
> already.
>
> http://www.inter7.com/vpopmail/vpopmail-4.10.15.tar.gz
>

Reply via email to