[libvirt] [PATCH 2/2] qemu: driver: Fix usage of qemuOpenFile

Peter Krempa posted 2 patches 8 years ago
[libvirt] [PATCH 2/2] qemu: driver: Fix usage of qemuOpenFile
Posted by Peter Krempa 8 years ago
The function returns -errno on failure, not only -1. This broken usage
was introduced by commit 732af77cce.
---
 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 92ef983ae..b238181f3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11327,7 +11327,7 @@ qemuDomainStorageOpenStat(virQEMUDriverPtr driver,
 {
     if (virStorageSourceIsLocalStorage(src)) {
         if ((*ret_fd = qemuOpenFile(driver, vm, src->path, O_RDONLY,
-                                    NULL, NULL)) == -1)
+                                    NULL, NULL)) < 0)
             return -1;

         if (fstat(*ret_fd, ret_sb) < 0) {
-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] qemu: driver: Fix usage of qemuOpenFile
Posted by Ján Tomko 8 years ago
On Wed, May 10, 2017 at 02:18:33PM +0200, Peter Krempa wrote:
>The function returns -errno on failure, not only -1. This broken usage
>was introduced by commit 732af77cce.

Actually, that was commit b4a40dd92dc7e6f110b13f2353cb5343d1147227

I am unsure why this function should return -errno since no caller
cares.

>---
> src/qemu/qemu_driver.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

ACK series if you fix the usage in qemuDomainBlockPeek as well.

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list