[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] mhstore -clobber
From: |
Ralph Corderoy |
Subject: |
Re: [Nmh-workers] mhstore -clobber |
Date: |
Sun, 16 Sep 2012 18:03:47 +0100 |
Hi David,
> > Strictly speaking, I wonder if it should be attempting to open(2)
> > each contender with O_CREAT | O_EXCL until one succeeds, at which
> > point it has the file descriptor to use. Unlikely to be an issue
> > with interactive use but perhaps with some procmail-type handling?
>
> Good point. There isn't a clean way to pass the fd with the existing
> code. Do you see any problems with this:
>
> if ((fd == open (file, O_CREAT | O_EXCL), mode) >= 0) {
> close (fd);
> break;
> }
>
> and later . . .
>
> fopen (file, "w") . . .
No, seems fine. You covered the old NFS O_EXCL/link(2) workaround
already.
Cheers, Ralph.