in reply to Re: •Re: Update in-place with temporary file and flocking
in thread Update in-place with temporary file and flocking

Once you have the file open, renaming it doesn't matter. The only problem is if someone edits the very file you have open, and the referenced code ensures that this never happens. That's what's nice about an atomic rename operation.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Re: •Re: Update in-place with temporary file and flocking

Replies are listed 'Best First'.
Re: •Re: Re: •Re: Update in-place with temporary file and flocking
by geohar (Acolyte) on Feb 18, 2004 at 20:44 UTC
    See my update, is it always ok, or just on UNIX style systems where the filehandle actually points at the file descriptor, rather than just refering to the file by name. Obviously if it's just referring by name then a rename breaks things, and the another instance of the script can't know that the file is actually locked, can it?