Patchwork [RFC,20/48] QemuOpts: Fix qemu_config_parse() to catch file read errors

login
register
mail settings
Submitter Markus Armbruster
Date Feb. 24, 2010, 5:55 p.m.
Message ID <1267034160-3517-21-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/46189/
State New
Headers show

Comments

Markus Armbruster - Feb. 24, 2010, 5:55 p.m.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qemu-config.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch

diff --git a/qemu-config.c b/qemu-config.c
index 78e5c67..acd4db7 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -475,6 +475,10 @@  int qemu_config_parse(FILE *fp, const char *fname)
         qemu_error("parse error");
         goto out;
     }
+    if (ferror(fp)) {
+        qemu_error("error reading file");
+        goto out;
+    }
     res = 0;
 out:
     loc_pop(&loc);