in reply to Re^2: Writing to a file atomically without renaming
in thread Writing to a file atomically without renaming
Worst case scenario the cat of the backup_file to temp_file fails and you're left with a corrupt "file" and the extra "backup_file" which would have to be moved back manually.eval { copy file to temp_file copy file to backup_file modify temp_file cat temp_file > file verify file is OK remove temp_file and backup_file }; if ( $@ ) { remove temp_file cat backup_file > file remove backup_file }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Writing to a file atomically without renaming
by salva (Canon) on Jun 30, 2005 at 20:47 UTC | |
Re^4: Writing to a file atomically without renaming
by waswas-fng (Curate) on Jun 30, 2005 at 22:38 UTC | |
by Transient (Hermit) on Jun 30, 2005 at 23:16 UTC | |
by waswas-fng (Curate) on Jun 30, 2005 at 23:22 UTC | |
by Transient (Hermit) on Jul 01, 2005 at 02:45 UTC |