Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/domain_conf.c | 34 +++++++++++++++++++++------------- src/conf/domain_conf.h | 6 +++--- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9f59756119..e99699028a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11891,12 +11891,14 @@ virDomainChrSourceDefParseTCP(virDomainChrSourceDefPtr def, def->data.tcp.service = virXMLPropString(source, "service"); if ((tmp = virXMLPropString(source, "tls"))) { - if ((def->data.tcp.haveTLS = virTristateBoolTypeFromString(tmp)) <= 0) { + int value; + if ((value = virTristateBoolTypeFromString(tmp)) <= 0) { virReportError(VIR_ERR_XML_ERROR, _("unknown chardev 'tls' setting '%s'"), tmp); return -1; } + def->data.tcp.haveTLS = value; VIR_FREE(tmp); } @@ -11975,12 +11977,15 @@ virDomainChrSourceDefParseFile(virDomainChrSourceDefPtr def, def->data.file.path = virXMLPropString(source, "path"); - if ((append = virXMLPropString(source, "append")) && - (def->data.file.append = virTristateSwitchTypeFromString(append)) <= 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid append attribute value '%s'"), - append); - return -1; + if ((append = virXMLPropString(source, "append"))) { + int value; + if ((value = virTristateSwitchTypeFromString(append)) <= 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid append attribute value '%s'"), + append); + return -1; + } + def->data.file.append = value; } return 0; @@ -12016,12 +12021,15 @@ virDomainChrSourceDefParseLog(virDomainChrSourceDefPtr def, def->logfile = virXMLPropString(log, "file"); - if ((append = virXMLPropString(log, "append")) && - (def->logappend = virTristateSwitchTypeFromString(append)) <= 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid append attribute value '%s'"), - append); - return -1; + if ((append = virXMLPropString(log, "append"))) { + int value; + if ((value = virTristateSwitchTypeFromString(append)) <= 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid append attribute value '%s'"), + append); + return -1; + } + def->logappend = value; } return 0; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 15dc416384..6619b9f006 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1232,7 +1232,7 @@ struct _virDomainChrSourceDef { /* no <source> for null, vc, stdio */ struct { char *path; - int append; /* enum virTristateSwitch */ + virTristateSwitch append; } file; /* pty, file, pipe, or device */ struct { char *master; @@ -1244,7 +1244,7 @@ struct _virDomainChrSourceDef { bool listen; int protocol; bool tlscreds; - int haveTLS; /* enum virTristateBool */ + virTristateBool haveTLS; bool tlsFromConfig; virDomainChrSourceReconnectDef reconnect; } tcp; @@ -1265,7 +1265,7 @@ struct _virDomainChrSourceDef { } spiceport; } data; char *logfile; - int logappend; + virTristateSwitch logappend; size_t nseclabels; virSecurityDeviceLabelDefPtr *seclabels; -- 2.26.2