[07/10] stdio_fclose: return -errno on errors (v2)
diff mbox

Message ID 1320928908-19076-8-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost Nov. 10, 2011, 12:41 p.m. UTC
This is what qemu_fclose() expects.

Changes v1 -> v2:
 - Add braces to if statement to match coding style

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

Patch
diff mbox

diff --git a/savevm.c b/savevm.c
index a870b3f..4ccbc1c 100644
--- a/savevm.c
+++ b/savevm.c
@@ -245,9 +245,12 @@  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)