[libvirt] [PATCH 1/3] avoid closing uninitialized fd

Wen Congyang wency at cn.fujitsu.com
Wed May 30 09:20:41 UTC 2012


If the system does not support bypass cache, we will close fd,
but it is uninitialized.

---
 src/qemu/qemu_driver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fea9c24..1b3391b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4010,7 +4010,7 @@ qemuDomainSaveImageOpen(struct qemud_driver *driver,
                         const char *xmlin, int state, bool edit,
                         bool unlink_corrupt)
 {
-    int fd;
+    int fd = -1;
     struct qemud_save_header header;
     char *xml = NULL;
     virDomainDefPtr def = NULL;
-- 
1.7.1




More information about the libvir-list mailing list