Patchwork [21/50] QemuOpts: Fix qemu_config_parse() to catch file read errors

login
register
mail settings
Submitter Markus Armbruster
Date March 4, 2010, 3:56 p.m.
Message ID <1267718231-13303-22-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/46957/
State New
Headers show

Comments

Markus Armbruster - March 4, 2010, 3:56 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 2de97cd..ad130fb 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -475,6 +475,10 @@  int qemu_config_parse(FILE *fp, const char *fname)
         error_report("parse error");
         goto out;
     }
+    if (ferror(fp)) {
+        error_report("error reading file");
+        goto out;
+    }
     res = 0;
 out:
     loc_pop(&loc);