qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/6] cpus: Improve error messages on memsave, pmemsave write


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 4/6] cpus: Improve error messages on memsave, pmemsave write error
Date: Mon, 13 May 2024 16:27:49 +0200
User-agent: Mozilla Thunderbird

On 13/5/24 16:17, Markus Armbruster wrote:
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>
---
  system/cpus.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/system/cpus.c b/system/cpus.c
index 68d161d96b..f8fa78f33d 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -813,7 +813,8 @@ void qmp_memsave(int64_t addr, int64_t size, const char 
*filename,
              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 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char 
*filename,
              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);

What about including errno with error_setg_errno()?

              goto exit;
          }
          addr += l;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]