[libvirt PATCH 15/38] domain_conf: Use virXMLProp(OnOff|YesNo) in virDomainChrSourceDefParseLog

Tim Wiederhake twiederh at redhat.com
Thu Mar 18 08:00:54 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/conf/domain_conf.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d9330f9ee7..b4928a94c2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11845,17 +11845,13 @@ static int
 virDomainChrSourceDefParseLog(virDomainChrSourceDefPtr def,
                               xmlNodePtr log)
 {
-    g_autofree char *append = NULL;
+    virTristateSwitch logappend = VIR_TRISTATE_SWITCH_ABSENT;
 
-    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);
+    if (virXMLPropOnOff(log, "append", &logappend) < 0)
         return -1;
-    }
+
+    def->logfile = virXMLPropString(log, "file");
+    def->logappend = logappend;
 
     return 0;
 }
-- 
2.26.2




More information about the libvir-list mailing list