Re: [PATCH 1/9] qemuDomainDetachDeviceConfig: make idx type of ssize_t

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

 



On 06/10/2016 08:02 AM, Laine Stump wrote:
On 06/09/2016 11:02 AM, Michal Privoznik wrote:
The variable is used to hold the index to the device array we are
trying to remove. All the functions that set it are expecting it
to be type of ssize_t instead of int.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
  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 e70d3ce..d7b65f1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7951,7 +7951,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
      virDomainControllerDefPtr cont, det_cont;
      virDomainChrDefPtr chr;
      virDomainFSDefPtr fs;
-    int idx;
+    ssize_t idx;

If you do this, then this code that uses idx will never detect a "not found" condition:

     if ((idx = virDomainNetFindIdx(vmdef, net)) < 0)
        return -1;

(there are several other similar uses in the same function)

Ugh. Nevermind. I looked at "ssize_t" and saw "size_t". Too early, not enough caffeine.

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]