A3.2-Mapfile

We saw in section III.2.3 that in case Tierra crashes (or exits using FEError()) during a run, the data in the mapfile can be corrupted. The solutions to this problem is two-fold, and was also outlined in the main text.

First, a backup of the mapfile should be made at startup, before actually reading the file to create the IPMap array. This backup should have an unique "well-known" name, because any temporary name would be lost in case of a crash. This way the previous state of the mapfile is preserved.

If Tierra goes down gracefully, the function treating its exiting should remove the backup from file.
This way, every time Tierra begins a run, it first checks for a backup mapfile. If one exists, Tierra delete the mapfile, and copy the backup to the name of the mapfile. It can then create the IPMap from the old mapfile data. If no backup mapfile can be found at startup, the mapfile is copied to the backup file, and the IPMap is created from the mapfile.