]> xenbits.xensource.com Git - libvirt.git/commitdiff
virnetserver: Check for virNetServerClientInitKeepAlive() retval
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 5 May 2020 09:29:13 +0000 (11:29 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 May 2020 11:08:34 +0000 (13:08 +0200)
Since it's introduction in v0.9.7-147-gf4324e3292 the
virNetServerClientInitKeepAlive() function returned nothing than
a negative one. Fortunately, this did not pose any problem
because we ignored the retval happily. Well, it's time to check
for the retval because the function might fail regularly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/rpc/virnetserver.c
src/rpc/virnetserverclient.c

index 242052754f7717709a418c4506c6c981009c95c1..07c8b85b76cbef303a558b778c548635231d7356 100644 (file)
@@ -306,8 +306,9 @@ int virNetServerAddClient(virNetServerPtr srv,
                                     virNetServerDispatchNewMessage,
                                     srv);
 
-    virNetServerClientInitKeepAlive(client, srv->keepaliveInterval,
-                                    srv->keepaliveCount);
+    if (virNetServerClientInitKeepAlive(client, srv->keepaliveInterval,
+                                        srv->keepaliveCount) < 0)
+        goto error;
 
     virObjectUnlock(srv);
     return 0;
index 657108239fdc23873a571662718a8870cfefe919..756adcbb4f715f87af1025d40cb63034feee558d 100644 (file)
@@ -1599,7 +1599,7 @@ virNetServerClientInitKeepAlive(virNetServerClientPtr client,
     virObjectRef(client);
 
     client->keepalive = ka;
-
+    ret = 0;
  cleanup:
     virObjectUnlock(client);