[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu: Unlink temporary file on failure

On 08/02/2011 09:36 AM, Michal Privoznik wrote:
Although virFDStreamOpenFile will unlink it once opened, when we hit
error path, we must unlink it by hand.
  src/qemu/qemu_driver.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 09b2791..d860cd2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2930,6 +2930,7 @@ qemuDomainScreenshot(virDomainPtr dom,
      ret = strdup("image/x-portable-pixmap");

+    unlink(tmp);

Swap these two lines.  Mingw doesn't like unlinking open files.

Also, you MUST check that tmp is not NULL (which is possible on some of the error paths); unlink(NULL) is a no-no.

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]