virnetserver: Check for virNetServerClientInitKeepAlive() retval

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>
This commit is contained in:
Michal Privoznik 2020-05-05 11:29:13 +02:00
parent d901fd6092
commit 1baead31fa
2 changed files with 4 additions and 3 deletions

View 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;

View File

@ -1599,7 +1599,7 @@ virNetServerClientInitKeepAlive(virNetServerClientPtr client,
virObjectRef(client);
client->keepalive = ka;
ret = 0;
cleanup:
virObjectUnlock(client);