[libvirt] [libvirt-php][PATCH] libvirt_domain_get_screenshot_api: Don't unlink screenshot file on success

Michal Privoznik mprivozn at redhat.com
Sat Sep 24 11:27:27 UTC 2016


In 5120ba28a2021 I've tried to fix couple of problems with this
API (all kinds of resource leaks, bad conditions to some checks
and so on). However, my clumsy fix introduced unlink even to a
success path so after all callers were left with a non-existent
path to screenshot file.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/libvirt-php.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 7916d07..693f911 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -4790,7 +4790,6 @@ PHP_FUNCTION(libvirt_domain_get_screenshot_api)
         VIRT_ADD_ASSOC_STRING(return_value, "file", fileNew);
         VIRT_ADD_ASSOC_STRING(return_value, "mime", "image/png");
     } else {
-        unlink(file);
         close(fd);
         fd = -1;
         VIRT_ADD_ASSOC_STRING(return_value, "file", file);
-- 
2.8.4




More information about the libvir-list mailing list