[Dirvish] patch for dirvish, long backups would overlap

Eric Searcy emsearcy at gmail.com
Tue Jan 4 01:42:58 UTC 2011


On Jan 2, 2011, at 2:13 PM, John Altstadt wrote:

[...]
> 
> +     if (! -f $lock_file)
> +     {
> +         open(LOCK, "+>", $lock_file) or seppuku 150, "cannot create $lock_file";
> +
[...]
> 
> I felt it was about time I contributed something back to the community again. Please feel free to use this patch or criticize it as you see fit. It works for me.

Good idea.  And for a suggestion: you should use a exclusive file lock (non-blocking to get the same behavior where you don't wait) to avoid the race condition that exists in the above code.

http://perldoc.perl.org/perlopentut.html#File-Locking

Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: This is a digitally signed message part
Url : http://www.dirvish.org/pipermail/dirvish/attachments/20110103/6a6793d8/attachment.bin 


More information about the Dirvish mailing list