mirror of https://github.com/bochs-emu/Bochs
Finally fixed memory restore state failure.
- When saving memory swap file, reset it's file pointer. - Using fflush() is not necessary here.
This commit is contained in:
parent
484b0eeee7
commit
50bac3b15c
|
@ -1410,12 +1410,13 @@ bool bx_real_sim_c::save_sr_param(FILE *fp, bx_param_c *node, const char *sr_pat
|
|||
FILE **fpp = ((bx_shadow_filedata_c*)node)->get_fpp();
|
||||
// If the backing store hasn't been created, just save an empty 0 byte placeholder file.
|
||||
if (*fpp != NULL) {
|
||||
char *buffer = new char[4096];
|
||||
fseeko64(*fpp, 0, SEEK_SET);
|
||||
while (!feof(*fpp)) {
|
||||
char buffer[64];
|
||||
size_t chars = fread (buffer, 1, sizeof(buffer), *fpp);
|
||||
size_t chars = fread (buffer, 1, 4096, *fpp);
|
||||
fwrite(buffer, 1, chars, fp2);
|
||||
}
|
||||
fflush(*fpp);
|
||||
delete [] buffer;
|
||||
}
|
||||
((bx_shadow_filedata_c*)node)->save(fp2);
|
||||
fclose(fp2);
|
||||
|
|
Loading…
Reference in New Issue