Patchwork [07/10] stdio_fclose: return -errno on errors

login
register
mail settings
Submitter Eduardo Habkost
Date Nov. 9, 2011, 10:03 p.m.
Message ID <1320876205-16113-8-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/124727/
State New
Headers show

Comments

Eduardo Habkost - Nov. 9, 2011, 10:03 p.m.
This is what qemu_fclose() expects.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 savevm.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/savevm.c b/savevm.c
index 5112d66..ee49288 100644
--- a/savevm.c
+++ b/savevm.c
@@ -244,9 +244,11 @@  static int stdio_pclose(void *opaque)
 static int stdio_fclose(void *opaque)
 {
     QEMUFileStdio *s = opaque;
-    fclose(s->stdio_file);
+    int ret = 0;
+    if (fclose(s->stdio_file) == EOF)
+        ret = -errno;
     g_free(s);
-    return 0;
+    return ret;
 }
 
 QEMUFile *qemu_popen(FILE *stdio_file, const char *mode)