[PATCH 3/3] gendispatch: Avoid comparing signed and unsigned vars

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

 



The adminDispatchConnectListServers() function is generated by
our great perl script. However, it has a tiny flaw: if
adminConnectListServers() it calls fails, the control jumps onto
cleanup label where we try to free any list of servers built so
far. However, in the loop @i is unsigned (size_t) while @nresults
is signed (int). Currently, it does no harm because of the check
for @result being non-NULL. But if that ever changes in the
future, this bug will be hard to chase.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/rpc/gendispatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index fc8423a..624049b 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -917,7 +917,7 @@ elsif ($mode eq "server") {
         print "    int rv = -1;\n";
 
         if ($modern_ret_as_list) {
-            print "    size_t i;\n";
+            print "    ssize_t i;\n";
         }
 
         foreach my $var (@vars_list) {
-- 
2.4.10

--
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]