]> xenbits.xensource.com Git - libvirt.git/commitdiff
gendispatch: Avoid comparing signed and unsigned vars
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 16 Mar 2016 09:24:38 +0000 (10:24 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 24 Mar 2016 09:49:39 +0000 (10:49 +0100)
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@redhat.com>
src/rpc/gendispatch.pl

index fc8423a6b621d0875ea0538786229b019c0aa855..624049bd7b53f2a59d6ea8a285f00ba2e1069ea9 100755 (executable)
@@ -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) {