cpus: Improve error messages on memsave, pmemsave write error
qmp_memsave() and qmp_pmemsave() report fwrite() error as
An IO error has occurred
Improve this to
writing memory to '<filename>' failed
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240513141703.549874-5-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/system/cpus.c b/system/cpus.c
index 68d161d..f8fa78f 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -813,7 +813,8 @@
goto exit;
}
if (fwrite(buf, 1, l, f) != l) {
- error_setg(errp, QERR_IO_ERROR);
+ error_setg(errp, "writing memory to '%s' failed",
+ filename);
goto exit;
}
addr += l;
@@ -843,7 +844,8 @@
l = size;
cpu_physical_memory_read(addr, buf, l);
if (fwrite(buf, 1, l, f) != l) {
- error_setg(errp, QERR_IO_ERROR);
+ error_setg(errp, "writing memory to '%s' failed",
+ filename);
goto exit;
}
addr += l;