[EMAIL PROTECTED] wrote:
> Quoting Henrik Grindal Bakken <[EMAIL PROTECTED]>:
>> But as you said, that breaks hard-links (who has hard-links to such
>> files anyway?). However, what if you first write to a temporary file,
>> then to the real file, and unlink the temp file if the close() and all
>> write()s to the real file succeeded?
> Well, there are a few issues with this; one is that it introduces alot of
> overhead, especially when saving over network.
Well, these files are normally relatively small, aren't they?
> Another is when one only has write-access to the data file and not
> the parent directory, causing the creation of the tempfile to fail.
Another possibility is to write the tempfile to /tmp. It will be deleted
when the real file is closed, but until then, it's kept as a backup.
Obviously, if the real write (or close) fails, the user must be told,
so he can take some action and save off the tempfile somewhere.
Henrik Grindal Bakken <[EMAIL PROTECTED]>
PGP ID: 8D436E52
Fingerprint: 131D 9590 F0CF 47EF 7963 02AF 9236 D25A 8D43 6E52