Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
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 e529eb7bc1..2ae3080a8c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11901,12 +11901,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);
}
@@ -11985,12 +11987,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;
@@ -12026,12 +12031,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 0c3d74095e..ad9b8f632b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1233,7 +1233,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;
@@ -1245,7 +1245,7 @@ struct _virDomainChrSourceDef {
bool listen;
int protocol;
bool tlscreds;
- int haveTLS; /* enum virTristateBool */
+ virTristateBool haveTLS;
bool tlsFromConfig;
virDomainChrSourceReconnectDef reconnect;
} tcp;
@@ -1266,7 +1266,7 @@ struct _virDomainChrSourceDef {
} spiceport;
} data;
char *logfile;
- int logappend;
+ virTristateSwitch logappend;
size_t nseclabels;
virSecurityDeviceLabelDefPtr *seclabels;
--
2.26.2