Patchwork [02/12] qemu-ga: qmp_guest_file_close(): fix fclose() error check

login
register
mail settings
Submitter Michael Roth
Date Jan. 8, 2013, 10:59 p.m.
Message ID <1357686009-13139-3-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/210571/
State New
Headers show

Comments

Michael Roth - Jan. 8, 2013, 10:59 p.m.
From: Luiz Capitulino <lcapitulino@redhat.com>

fclose() returns EOF on error.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/commands-posix.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index bbef66d..ebb58be 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -170,7 +170,7 @@  void qmp_guest_file_close(int64_t handle, Error **err)
     }
 
     ret = fclose(gfh->fh);
-    if (ret == -1) {
+    if (ret == EOF) {
         error_set(err, QERR_QGA_COMMAND_FAILED, "fclose() failed");
         return;
     }