Re: open and edit file to prevent race conditions
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Mon, 29 Aug 2005 03:24:08 -0700
Brent Clark wrote:
> Hi List
Hello,
> I have a scenario / debate if you wish with my colleague.
>
> The problem is I have to update a CSV file and the way I do it open the
> file while reading / editting it I then send it to a temp file, unlink
> the original and the rename the temp
> to the original file name (Baring in mind I do flock the file)
>
> My colleague, disagrees with my approach to this, he is adamant that I
> must open the file get the file in memory and use seek etc to update the
> file (also using flock etc.)
>
> So basically from the millisecond it takes to unlock , close, unlink,
> and then rename the file, I am open to race condition.
>
> So my question is, whats the best what to update / amend a file.
>
> Your tips and or advice, would great fully be appreciated.
Which operating system is this file on? Do you have ACLs or some such
security to guaranty file locking?
John
--
use Perl;
program
fulfillment
.
- Follow-Ups:
- Re: open and edit file to prevent race conditions
- From: Brent Clark
- Re: open and edit file to prevent race conditions
- References:
- open and edit file to prevent race conditions
- From: Brent Clark
- open and edit file to prevent race conditions
- Prev by Date: Re: Posting all files in a directory as hyperlinks
- Next by Date: Re: class regex
- Previous by thread: open and edit file to prevent race conditions
- Next by thread: Re: open and edit file to prevent race conditions
- Index(es):