1

Topic: mapeditor, please use "sync-secure" writing.

Hi, yesterday my mapeditor segfaulted while trying to save the file. The result was a zero size map file! So I not only lost my current changes, I lost the whole map! (Well at least I would have lost it, if I wouldn't have been lucky enough to had a test server running at the moment, so I could conntect to my server and download my last version of the map from a 2 hours ago into the .teewars/maps directory...)

Sorry, I cannot reproduce this segfault, it had something to do with some replacing .png image file, I think one of the pngs was broken. But can you please change the writing algorithm into something like this (here in pseudo code)? So you are never left with a zero size map?

-----
F = FOPEN(filename + ".tmp");
WRITE_DATA(F);
FCLOSE(F);
SNYC(); /* I don't know the windows equivalent, but at least on unix system the sync() call garantees that on return all changes an application has done to the filesystem are on disc, an non in memory cache. */
MOVE(filename + ".tmp", filename);
RETURN;
-----

This way, whenever the actual writer segfaults, or the computer looses power, or an silicon eating and eats up the CPU. You are always left at least with your old map, when overwritting it with the new one didn't work out...

Thanks,
catpaw.

2

Re: mapeditor, please use "sync-secure" writing.

Had severall segfaults while writing the map, all with different doings, I just cannot get a clean structure in it, when to raise it.

Do you want coredumps in future?