[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] extensions on tmp filenames?
From: |
David Levine |
Subject: |
Re: [Nmh-workers] extensions on tmp filenames? |
Date: |
Sun, 02 Feb 2014 09:02:33 -0500 |
Lyndon wrote:
> On Feb 1, 2014, at 2:30 PM, David Levine <address@hidden> wrote:
>
> > rename allows the new filename to refer
> > to the old file, even if very briefly. So I removed that
> > rename.
>
> If it does, it's horribly broken. ISO C demands that rename() be atomic
> - that's the whole reason for its existence.
Well, that's the way it's documented. This is when an existing
file is in the way of the new name.
I went with mkstemps(3), where available. If not available,
it tries link(2), and if that fails, rename(2).
David