summaryrefslogtreecommitdiffstats
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/monitor.c b/monitor.c
index ae3300b..2f38601 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1324,10 +1324,14 @@ static void do_memory_save(Monitor *mon, const QDict *qdict, QObject **ret_data)
if (l > size)
l = size;
cpu_memory_rw_debug(env, addr, buf, l, 0);
- fwrite(buf, 1, l, f);
+ if (fwrite(buf, 1, l, f) != l) {
+ monitor_printf(mon, "fwrite() error in do_memory_save\n");
+ goto exit;
+ }
addr += l;
size -= l;
}
+exit:
fclose(f);
}
@@ -1351,11 +1355,15 @@ static void do_physical_memory_save(Monitor *mon, const QDict *qdict,
if (l > size)
l = size;
cpu_physical_memory_rw(addr, buf, l, 0);
- fwrite(buf, 1, l, f);
+ if (fwrite(buf, 1, l, f) != l) {
+ monitor_printf(mon, "fwrite() error in do_physical_memory_save\n");
+ goto exit;
+ }
fflush(f);
addr += l;
size -= l;
}
+exit:
fclose(f);
}
OpenPOWER on IntegriCloud