On Mon, Jul 11, 2011 at 05:44:59PM -0600, Eric Blake wrote:
* src/qemu/qemu_driver.c (doCoreDump): Guarantee fd is closed.
---
Spotted by hand, while working on virDomainSaveFlags.
src/qemu/qemu_driver.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1356c54..f9d2de4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2525,10 +2525,11 @@ cleanup:
return ret;
}
-static int doCoreDump(struct qemud_driver *driver,
- virDomainObjPtr vm,
- const char *path,
- enum qemud_save_formats compress)
+static int
+doCoreDump(struct qemud_driver *driver,
+ virDomainObjPtr vm,
+ const char *path,
+ enum qemud_save_formats compress)
{
int fd = -1;
int ret = -1;
@@ -2554,6 +2555,7 @@ static int doCoreDump(struct qemud_driver *driver,
ret = 0;
cleanup:
+ VIR_FORCE_CLOSE(fd);
if (ret != 0)
unlink(path);
return ret;
ACK
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|