Flush all data before we save the MAGIC_NUMBER for each file in the backup process

This commit is contained in:
David Capello 2015-06-10 20:02:44 -03:00
parent edb4971b4c
commit 823ccb6b0c

View File

@ -180,6 +180,10 @@ private:
write32(s, 0); // Leave a room for the magic number
(this->*writeMember)(s, obj); // Write the object
// Flush all data. In this way we ensure that the magic number is
// the last thing being written in the file.
s.flush();
// Write the magic number
s.seekp(0);
write32(s, MAGIC_NUMBER);