Forked from
Kart Krew / RingRacers
Source project has a limited visibility.
-
Eidolon authored
The hypothesis for this patch is that the operating system has not actually finished writing the file to disk when moving the tmp file into place. The move operation is atomic, but the write is not, even when flushed or using unbuffered IO. So we reorder these operations, make the old save .bak atomically and write the new save in place. I doubt saving this backup will actually be useful given the frequency of saves in the game, but at the very least it leaves _some_ backup in place in the event of failure.
Eidolon authoredThe hypothesis for this patch is that the operating system has not actually finished writing the file to disk when moving the tmp file into place. The move operation is atomic, but the write is not, even when flushed or using unbuffered IO. So we reorder these operations, make the old save .bak atomically and write the new save in place. I doubt saving this backup will actually be useful given the frequency of saves in the game, but at the very least it leaves _some_ backup in place in the event of failure.