From: Peter Krempa Date: Fri, 19 Nov 2021 12:25:00 +0000 (+0100) Subject: qemuMonitorJSONBuildChrChardevReconnect: Unify with qemuBuildChrChardevReconnectStr X-Git-Tag: v7.10.0-rc1~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03cab99ca5cbddfa51467b3173a97741a5070a96;p=thirdparty%2Flibvirt.git qemuMonitorJSONBuildChrChardevReconnect: Unify with qemuBuildChrChardevReconnectStr When formatting the commandline we explicitly set the reconnect timeout to 0 when it's disabled even when that's the default. Do the same in the monitor/hotplug code. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8132ff0dca..437550a2fc 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6600,10 +6600,22 @@ static int qemuMonitorJSONBuildChrChardevReconnect(virJSONValue *object, const virDomainChrSourceReconnectDef *def) { - if (def->enabled != VIR_TRISTATE_BOOL_YES) + int timeout = 0; + + switch (def->enabled) { + case VIR_TRISTATE_BOOL_ABSENT: + case VIR_TRISTATE_BOOL_LAST: return 0; - return virJSONValueObjectAppendNumberUint(object, "reconnect", def->timeout); + case VIR_TRISTATE_BOOL_YES: + timeout = def->timeout; + break; + + case VIR_TRISTATE_BOOL_NO: + break; + } + + return virJSONValueObjectAppendNumberUint(object, "reconnect", timeout); } static virJSONValue *