[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating backups in temporary directories

From: Davis Herring
Subject: Re: creating backups in temporary directories
Date: Mon, 10 Sep 2007 12:18:36 -0700 (PDT)
User-agent: SquirrelMail/1.4.8-6.el3.2lanl

> Well, seems I misread the manual page for open/creat.  I thought that
> without O_EXCL, the file would get replaced.
> Well, then there still is the contorted way of hard linking /tmp/foo
> to /tmp/foo~, opening /tmp/randomfilename for write, renaming it to
> /tmp/foo and then finishing the write operation.

Why not just rename /tmp/foo to /tmp/foo~, then open /tmp/foo with O_EXCL?
 If it fails, then write (again with O_EXCL) to /tmp/randomfile so that
the user's work is on disk -somewhere-, and tell them that they have


This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during

reply via email to

[Prev in Thread] Current Thread [Next in Thread]