Skip to content
Snippets Groups Projects
Forked from Kart Krew / RingRacers
Source project has a limited visibility.
  • Eidolon's avatar
    53832eda
    Move old data/profiles to .bak before writing · 53832eda
    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.
    53832eda
    History
    Move old data/profiles to .bak before writing
    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.