Patchwork [06/10] stdio_pclose: return -errno on error (v3)

login
register
mail settings
Submitter Eduardo Habkost
Date Nov. 10, 2011, 12:41 p.m.
Message ID <1320928908-19076-7-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/124882/
State New
Headers show

Comments

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

Changes v1 -> v2:
 - On success, keep returning pclose() return value, instead of always 0.

Changes v2 -> v3:
 - Add braces on if statements to match coding style

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

Patch

diff --git a/savevm.c b/savevm.c
index 2fef693..a870b3f 100644
--- a/savevm.c
+++ b/savevm.c
@@ -235,6 +235,9 @@  static int stdio_pclose(void *opaque)
     QEMUFileStdio *s = opaque;
     int ret;
     ret = pclose(s->stdio_file);
+    if (ret == -1) {
+        ret = -errno;
+    }
     g_free(s);
     return ret;
 }