Additionally fixed condition to use proper type define, thanks to John Ferlan Signed-off-by: Dmitry Mishin <dim@xxxxxxxxxxxxx> --- src/conf/domain_conf.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f210c0b..9d47846 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1723,10 +1723,11 @@ virDomainChrSourceDefCopy(virDomainChrSourceDefPtr dest, switch (src->type) { case VIR_DOMAIN_CHR_TYPE_FILE: - dest->data.file.append = src->data.file.append; case VIR_DOMAIN_CHR_TYPE_PTY: case VIR_DOMAIN_CHR_TYPE_DEV: case VIR_DOMAIN_CHR_TYPE_PIPE: + if (src->type == VIR_DOMAIN_CHR_TYPE_FILE) + dest->data.file.append = src->data.file.append; if (VIR_STRDUP(dest->data.file.path, src->data.file.path) < 0) return -1; break; @@ -9386,12 +9387,12 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, switch ((virDomainChrType) def->type) { case VIR_DOMAIN_CHR_TYPE_FILE: - if (!append) - append = virXMLPropString(cur, "append"); case VIR_DOMAIN_CHR_TYPE_PTY: case VIR_DOMAIN_CHR_TYPE_DEV: case VIR_DOMAIN_CHR_TYPE_PIPE: case VIR_DOMAIN_CHR_TYPE_UNIX: + if (!append && def->type == VIR_DOMAIN_CHR_TYPE_FILE) + append = virXMLPropString(cur, "append"); /* PTY path is only parsed from live xml. */ if (!path && (def->type != VIR_DOMAIN_CHR_TYPE_PTY || @@ -9476,15 +9477,15 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, break; case VIR_DOMAIN_CHR_TYPE_FILE: - if (append && + case VIR_DOMAIN_CHR_TYPE_PTY: + case VIR_DOMAIN_CHR_TYPE_DEV: + case VIR_DOMAIN_CHR_TYPE_PIPE: + if (append && def->type == VIR_DOMAIN_CHR_TYPE_FILE && (def->data.file.append = virTristateSwitchTypeFromString(append)) <= 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid append attribute value '%s'"), append); goto error; } - case VIR_DOMAIN_CHR_TYPE_PTY: - case VIR_DOMAIN_CHR_TYPE_DEV: - case VIR_DOMAIN_CHR_TYPE_PIPE: if (!path && def->type != VIR_DOMAIN_CHR_TYPE_PTY) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -20071,7 +20072,7 @@ virDomainChrSourceDefFormat(virBufferPtr buf, virBufferEscapeString(buf, "<source path='%s'", def->data.file.path); if (def->type == VIR_DOMAIN_CHR_TYPE_FILE && - def->data.file.append) + def->data.file.append != VIR_TRISTATE_SWITCH_ABSENT) virBufferAsprintf(buf, " append='%s'", virTristateSwitchTypeToString(def->data.file.append)); virDomainSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags); -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list