mirror of https://gitee.com/openkylin/libvirt.git
virNetServerNewPostExecRestart: Initialize @max_anonymous_clients
Coverity spotted a use of possibly undefined variable. If a server is restarting as an result of update, the JSON file that keeps current value of some variables will not contain the new variables. This is the case of @max_anonymous_clients too. We are correctly querying if there's "max_anonymous_clients" in the JSON, however, we are not setting a sane default if there's none. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
149733821d
commit
1a8d91d922
|
@ -494,13 +494,16 @@ virNetServerPtr virNetServerNewPostExecRestart(virJSONValuePtr object,
|
||||||
_("Missing max_clients data in JSON document"));
|
_("Missing max_clients data in JSON document"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (virJSONValueObjectHasKey(object, "max_anonymous_clients") &&
|
if (virJSONValueObjectHasKey(object, "max_anonymous_clients")) {
|
||||||
virJSONValueObjectGetNumberUint(object, "max_anonymous_clients",
|
if (virJSONValueObjectGetNumberUint(object, "max_anonymous_clients",
|
||||||
&max_anonymous_clients) < 0) {
|
&max_anonymous_clients) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Malformed max_anonymous_clients data in JSON document"));
|
_("Malformed max_anonymous_clients data in JSON document"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
max_anonymous_clients = max_clients;
|
||||||
|
}
|
||||||
if (virJSONValueObjectGetNumberUint(object, "keepaliveInterval", &keepaliveInterval) < 0) {
|
if (virJSONValueObjectGetNumberUint(object, "keepaliveInterval", &keepaliveInterval) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Missing keepaliveInterval data in JSON document"));
|
_("Missing keepaliveInterval data in JSON document"));
|
||||||
|
|
Loading…
Reference in New Issue